C++ | Constructors | Question 17
Explanation: Since there is no copy constructor, the compiler creates a copy constructor. The compiler created copy constructor does shallow copy in line ” String s2 = s1;”
So str pointers of both s1 and s2 point to the same location.
There must be a user defined copy constructor in classes with pointers ot dynamic memory allocation.
Quiz of this Question