1. Shallow Copy
A shallow copy creates a new object, but does not copy nested objects.
It only copies the reference (address) of inner objects.
So, changes in nested objects will affect both original and copied object.Deep Copy
A deep copy creates a new object and copies all nested objects as well.
It makes a completely independent copy.
Changes in one will not affect the other.

Leave a Reply
You must be logged in to post a comment.