Copy constrctor

how we can make our own copy constructor in order to get deep copy??

image
Copy constructor, in general, is not required to be defined by the user, as the compiler automatically provides a default copy constructor. However, this default copy constructor performs a shallow copy only (i.e. copy values only). This results in pointer variables pointing the same instances upon copy.
While in a deep copy we make sure that the pointers don’t point to the same instances.
That is why in the above picture a new array is defined dynamically and the values are assigned to those memory locations .