Question: what is the difference between deep copy and shallow copy in c++?
Answer: A shallow copy of an object copies all of the member field values. This works well if the fields are values, but may not be what you want for fields that point to dynamically allocated memory. ... A deep copy copies all fields, and makes copies of dynamically allocated memory pointed to by the fields.