COMP 206 Unit 6: Initialization and Cleanup

Descripción

University-level C++ COMP 206 Fichas sobre COMP 206 Unit 6: Initialization and Cleanup, creado por Adriana Vincelli-Joma el 15/09/2021.
Adriana Vincelli-Joma
Fichas por Adriana Vincelli-Joma, actualizado hace más de 1 año
Adriana Vincelli-Joma
Creado por Adriana Vincelli-Joma hace alrededor de 3 años
2
0

Resumen del Recurso

Pregunta Respuesta
constructor special member function that initializes class instance
destructor - constructor's complement - cleans up object when no longer needed -destructs/deletes object
definition block variables defined at the beginning of a block after opening brace
2 reasons to dispense with definition block 1. reduce duration of variable's availability within scope; reduce chance it will be misused in some other part of scope 2. readability is improved because reader doesn't have to jump back and forth to beginning of scope to know type of variable
lifetime of loop variable variable lifetime extended to end of scope that enclosed for loop
aggregate bunch of things clumped together
aggregate types 1. mixed types: structs and classes 2. single type: array
Way in which aggregate type is initialized - make assignment, and initialization will be taken care of by compiler - elements in assignment must be surrounded by curly braces -all initialization must go through constructor, even if using aggregate initialization
default constructor - called with no arguments -creates "vanilla object" -used when compiler is told to create object but isn't given any details
Mostrar resumen completo Ocultar resumen completo

Similar

COMP 206 Unit 11: Operator Overloading
Adriana Vincelli-Joma
COMP 206 Unit 9: Name Control
Adriana Vincelli-Joma
COMP 206 Unit 13: Inheritance and Composition
Adriana Vincelli-Joma
COMP 206 Unit 5: Hiding the Implementation
Adriana Vincelli-Joma
COMP 206 Unit 12: Dynamic Object Creation
Adriana Vincelli-Joma
COMP 206 Unit 7: Function Overloading and Default Arguments
Adriana Vincelli-Joma
COMP 206 Unit 8: Constants
Adriana Vincelli-Joma
COMP 206 Unit 3: The C in C++
Adriana Vincelli-Joma
GOVN 377 Unit 8: The Brave New World of Data Management and Manipulation
Adriana Vincelli-Joma
HIST 404: Unit 4 Science in the Renaissance
Adriana Vincelli-Joma
HIST 404: Unit 9 Discovering DNA
Adriana Vincelli-Joma