Computer Science, asked by ishan488, 1 year ago

What is deep copy? a deep copy creates a copy of the dynamically allocated objects too. a deep copy just copies the values of the data as they are. a deep copy creates a copy of the statically allocated objects too both b and c above?

Answers

Answered by TheUnknownUser
7

A deep copy creates a copy of the dynamically allocated objects too.

A deep copy copies all fields, and makes copies of dynamically allocated memory pointed to by the fields. To make a deep copy, you must write a copy constructor and overload the assignment operator, otherwise the copy will point to the original, with disastrous consequences.

Similar questions