Created by Adriana Vincelli-Joma
about 3 years ago
|
||
Question | Answer |
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 |
Want to create your own Flashcards for free with GoConqr? Learn more.