top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is a deep copy?

+1 vote
404 views
What is a deep copy?
posted Mar 2, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

A deep copy copies all fields, and makes copies of dynamically allocated memory pointed to by the fields. A deep copy occurs when an object is copied along with the objects to which it refers. Shallow Copy. Shallow copy is a bit-wise copy of an object.

answer Mar 3, 2017 by Bheemalinga Reddy B
0 votes

A deep copy duplicates the object or variable being pointed to so that the destination (the object being assigned to) receives it’s own local copy. This way, the destination can do whatever it wants to it’s local copy and the object that was copied from will not be affected.
Doing deep copies requires that we write our own copy constructors and overloaded assignment operators if we are working with C++ or Java.

answer Mar 3, 2017 by Salil Agrawal
...