1.

What is the difference between shallow copy and deep copy?

Answer»

The DIFFERENCE between shallow copy and a deep copy is given below:

Shallow CopyDeep Copy
Shallow copy STORES the references of objects to the ORIGINAL memory address.Deep copy makes a new and separate copy of an entire object with its unique memory address.
Shallow copy is faster.Deep copy is COMPARATIVELY slower.
Shallow copy reflects CHANGES made to the new/copied object in the original object.Deep copy doesn’t reflect changes made to the new/copied object in the original object


Discussion

No Comment Found