+ 1
When no copy constructor is defined, the compiler supplies its own copy comstructor.
Copy constructor query
5 Respostas
+ 9
this explained rather well here:
https://www.hackerearth.com/practice/notes/deep-copy-and-shallow-copy/
+ 9
that is correct
but take into consideration that the copy constructor only performs shallow copy of variables, meaning that if you use pointers or references to another objects, you will get 2 objects which points to the same addresses.
and ince one object is deleted, if the references are properly cleaned, the other object will point to garbage values and you don't want that
tl/dr: implement your own copy constructors
+ 5
yes it is useful as it allows you
to do certain things which
would require a constr
but better define your own
+ 1
Thanks
0
Can u please give a code related to it so that i can understand it clearly sir..