What are shallow and deep copy?

What are shallow and deep copy?

- A shallow copy just copies the values of the data as they are. Even if there is a pointer that points to dynamically allocated memory, the pointer in the copy will point to the same dynamically allocated object.
- A deep copy creates a copy of the dynamically allocated objects too. You would need to use a copy constructor and overload an assignment operator for this.
What is virtual constructors/destructors?
What is virtual constructors/destructors? - The explicit destroying of object with the use of delete operator to a base class pointer to the object...
When should we use container classes instead of arrays? - C++
When should we use container classes instead of arrays? - It is advisable to use container classes of the STL so that you don’t have to go through the pain of writing...
Difference between a homogeneous and a heterogeneous container
Difference between a homogeneous and a heterogeneous container - When a container class contains a group of mixed objects, the container is called a heterogeneous container....
Post your comment