13.01.2015 Views

Pensar en C++ (Volumen 1) - Grupo ARCO

Pensar en C++ (Volumen 1) - Grupo ARCO

Pensar en C++ (Volumen 1) - Grupo ARCO

SHOW MORE
SHOW LESS

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

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

✐<br />

✐<br />

✐<br />

“Volum<strong>en</strong>1” — 2012/1/12 — 13:52 — page XI — #11<br />

✐<br />

Índice g<strong>en</strong>eral<br />

10.2.2.2. La directiva using . . . . . . . . . . . . . . . . . . . . 284<br />

10.2.2.3. La declaración using . . . . . . . . . . . . . . . . . . . 286<br />

10.2.3. El uso de los espacios de nombres . . . . . . . . . . . . . . . . . 287<br />

10.3. Miembros estáticos <strong>en</strong> <strong>C++</strong> . . . . . . . . . . . . . . . . . . . . . . . . . 287<br />

10.3.1. Definición del almac<strong>en</strong>ami<strong>en</strong>to para atributos estáticos . . . . . 288<br />

10.3.1.1. Inicialización de vectores estáticos . . . . . . . . . . . . 289<br />

10.3.2. Clases anidadas y locales . . . . . . . . . . . . . . . . . . . . . . 291<br />

10.3.3. Métodos estáticos . . . . . . . . . . . . . . . . . . . . . . . . . . . 292<br />

10.4. Dep<strong>en</strong>d<strong>en</strong>cia <strong>en</strong> la inicialización de variables estáticas . . . . . . . . . . 294<br />

10.4.1. Qué hacer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296<br />

10.4.1.1. Técnica uno . . . . . . . . . . . . . . . . . . . . . . . . . 296<br />

10.4.1.2. Técnica dos . . . . . . . . . . . . . . . . . . . . . . . . . 298<br />

10.5. Especificaciones de <strong>en</strong>lazado alternativo . . . . . . . . . . . . . . . . . . 302<br />

10.6. Resum<strong>en</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302<br />

10.7. Ejercicios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303<br />

11. Las refer<strong>en</strong>cias y el constructor de copia 307<br />

11.1. Punteros <strong>en</strong> <strong>C++</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307<br />

11.2. Refer<strong>en</strong>cias <strong>en</strong> <strong>C++</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308<br />

11.2.1. Refer<strong>en</strong>cias <strong>en</strong> las funciones . . . . . . . . . . . . . . . . . . . . . 308<br />

11.2.1.1. Refer<strong>en</strong>cias constantes . . . . . . . . . . . . . . . . . . 309<br />

11.2.1.2. Refer<strong>en</strong>cias a puntero . . . . . . . . . . . . . . . . . . . 310<br />

11.2.2. Consejos para el paso de argum<strong>en</strong>tos . . . . . . . . . . . . . . . 311<br />

11.3. El constructor de copia . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311<br />

11.3.1. Paso y retorno por valor . . . . . . . . . . . . . . . . . . . . . . . 311<br />

11.3.1.1. Paso y retorno de objetos grandes . . . . . . . . . . . . 312<br />

11.3.1.2. Marco de pila para llamadas a función . . . . . . . . . 313<br />

11.3.1.3. Re-<strong>en</strong>trada . . . . . . . . . . . . . . . . . . . . . . . . . 313<br />

11.3.1.4. Copia bit a bit vs. inicialización . . . . . . . . . . . . . 314<br />

11.3.2. Construcción por copia . . . . . . . . . . . . . . . . . . . . . . . 316<br />

11.3.2.1. Objetos temporales . . . . . . . . . . . . . . . . . . . . 320<br />

11.3.3. El constructor de copia por defecto . . . . . . . . . . . . . . . . . 320<br />

11.3.4. Alternativas a la construcción por copia . . . . . . . . . . . . . . 322<br />

11.3.4.1. Evitando el paso por valor . . . . . . . . . . . . . . . . 322<br />

11.3.4.2. Funciones que modifican objetos externos . . . . . . . 323<br />

11.4. Punteros a miembros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323<br />

11.4.1. Funciones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325<br />

11.4.1.1. Un ejemplo . . . . . . . . . . . . . . . . . . . . . . . . . 326<br />

XI<br />

✐<br />

✐<br />

✐<br />

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

Saved successfully!

Ooh no, something went wrong!