Chapter 14 Flashcards
1
Q
What is deep copy
A
If an object has pointers to dynamically allocated memory, and the dynamically allocated memory needs to be copied when the original object is copied, then a deep copy is required.
2
Q
What is shallow copy
A
A shallow copy of an object copies all of the member field values.
3
Q
How constructor called in composition in the relationship of sub and main object
A
The constructor of sub object always calls first and then constructor of main object called.
4
Q
How destructor called in composition in the relationship of sub and main object
A
The destructor of main object called always calls first and then destructor of sub object