harry said:
As i know that copy constructor copies a existing object to a non
existing object, which you are going to create. and Assignment
operation can happen between two existing objects.
but i have confusion that which one referring shallow copy and deep
copy.
There is no "shallow copy" or "deep copy" as far as copying is
concerned. The default behaviour of the copy-constructor is to
copy-construct all members, following individual member type's
copy-construction semantics. The default behaviour of the copy
assignment operator is to copy-assign all members following the copy
assignment semantics for every individual member type. Array members
(while arrays in C++ have no copy assignment or copy construction
defined for them when they are stand-alone) are still constructed or
assigned element by element (again, following the semantics for the type
of the element). Those semantics *nest*.
V