Pensar en C++ (Volumen 1) - Grupo ARCO
Pensar en C++ (Volumen 1) - Grupo ARCO
Pensar en C++ (Volumen 1) - Grupo ARCO
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 VIII — #8<br />
✐<br />
Índice g<strong>en</strong>eral<br />
4.7.1. Importancia de los ficheros de cabecera . . . . . . . . . . . . . . 158<br />
4.7.2. El problema de la declaración múltiple . . . . . . . . . . . . . . 160<br />
4.7.3. Las directivas del preprocesador #define, #ifndef y #<strong>en</strong>dif . . . 160<br />
4.7.4. Un estándar para los ficheros de cabecera . . . . . . . . . . . . . 161<br />
4.7.5. Espacios de nombres <strong>en</strong> los ficheros de cabecera . . . . . . . . . 162<br />
4.7.6. Uso de los ficheros de cabecera <strong>en</strong> proyectos . . . . . . . . . . . 162<br />
4.8. Estructuras anidadas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163<br />
4.8.1. Resolución de ámbito global . . . . . . . . . . . . . . . . . . . . 166<br />
4.9. Resum<strong>en</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166<br />
4.10. Ejercicios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167<br />
5. Ocultar la implem<strong>en</strong>tación 171<br />
5.1. Establecer los límites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171<br />
5.2. Control de acceso <strong>en</strong> <strong>C++</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . 172<br />
5.2.1. protected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173<br />
5.3. Amigos (fri<strong>en</strong>ds) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173<br />
5.3.1. Amigas anidadas . . . . . . . . . . . . . . . . . . . . . . . . . . . 175<br />
5.3.2. ¿Es eso puro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177<br />
5.4. Capa de objetos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178<br />
5.5. La clase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178<br />
5.5.1. Modificaciones <strong>en</strong> Stash para usar control de acceso . . . . . . 181<br />
5.5.2. Modificar Stack para usar control de acceso . . . . . . . . . . . 181<br />
5.6. Manejo de clases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182<br />
5.6.1. Ocultar la implem<strong>en</strong>tación . . . . . . . . . . . . . . . . . . . . . 182<br />
5.6.2. Reducir la recompilación . . . . . . . . . . . . . . . . . . . . . . 183<br />
5.7. Resum<strong>en</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185<br />
5.8. Ejercicios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185<br />
6. Inicialización y limpieza 187<br />
6.1. Inicialización garantizada por el constructor . . . . . . . . . . . . . . . 188<br />
6.2. Limpieza garantizada por el destructor . . . . . . . . . . . . . . . . . . 189<br />
6.3. Eliminación del bloque de definiciones . . . . . . . . . . . . . . . . . . . 191<br />
6.3.1. Bucles for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192<br />
6.3.2. Alojami<strong>en</strong>to de memoria . . . . . . . . . . . . . . . . . . . . . . 193<br />
6.4. Stash con constructores y destructores . . . . . . . . . . . . . . . . . . . 194<br />
6.5. Stack con constructores y destructores . . . . . . . . . . . . . . . . . . . 197<br />
6.6. Inicialización de tipos agregados . . . . . . . . . . . . . . . . . . . . . . 199<br />
6.7. Constructores por defecto . . . . . . . . . . . . . . . . . . . . . . . . . . 201<br />
6.8. Resum<strong>en</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202<br />
VIII<br />
✐<br />
✐<br />
✐<br />
✐