0
Deep copy memory issue
Tried copy constructor but getting memory issue What's wrong here? https://code.sololearn.com/cJzDGiQ1UtM9/?ref=app
3 Antworten
+ 1
At the moment, you just copy the pointer, not the object, and delete that before the second call to display(), which is undefined behaviour. In order to call the copy constructor, you would have to write:
clsTest* p2 = new clsTest(*p1);
+ 1
I see your questions in my feed, but not in the Q&A most recent view. Strange.
0
It seems some issue with sololearn now a days.... I already informed them about other issue that is missing code lines when saved from windows laptop and checked on android mobile app