04.06.2015 Views

Manual básico de Programación en C++

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

};<br />

// Continuamos con el ejemplo:<br />

Punto (const int x, const int y)<br />

{<br />

_x = xval;<br />

_y = yval;<br />

}<br />

Punto (const Punto &<strong>de</strong>s<strong>de</strong>)<br />

{<br />

_x = <strong>de</strong>s<strong>de</strong>._x;<br />

_y = <strong>de</strong>s<strong>de</strong>._y;<br />

}<br />

∼ Punto() { /* ¡Nada que hacer! */}<br />

void setX(const int val);<br />

void setY(const int val);<br />

int getX() {return _x;}<br />

int getY() {return _y;}<br />

3.6. CUANDO SON LLAMADOS LOS DESTRUCTORES Y CONSTRUCTORES<br />

Por lo regular, son llamados <strong>de</strong> forma automática. En g<strong>en</strong>eral, las llamadas <strong>de</strong><br />

<strong>de</strong>structor se efectúan <strong>en</strong> or<strong>de</strong>n inverso a las llamadas <strong>de</strong> constructor.<br />

3.7. ASIGNACIÓN POR OMISION EN COPIA A NIVEL DE MIEMBRO<br />

El operador <strong>de</strong> asignación ( = ) es utilizado para asignar un objeto a otro objeto <strong>de</strong>l<br />

mismo tipo.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!