Are you sure you want to delete this flashcard?

CPlusPlus

What is the difference between a shallow copy and a deep copy?

Shallow copy copies only object's memory references, not the actual data. Changes to original affect the copy if shared resources are modified. A deep copy duplicates actual data, creating independent objects. Changes to one don't affect the other.

1

https://www.geeksforgeeks.org/difference-between-shallow-and-deep-copy-of-a-class/

1

Cancel