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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is shallow copy

A

A shallow copy of an object copies all of the member field values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly