What is the interpretation of the output of the following code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the interpretation of the output of the following code?

https://code.sololearn.com/c27N9DlFbD5x/?ref=app

25th Feb 2022, 5:02 PM
محمد الشاوش
محمد الشاوش - avatar
3 Answers
+ 3
~Cpp() is destructor Cpp() and Cpp(string n) are construsctors Destructors happen when you delete an object Constructors are ways you can make an object
25th Feb 2022, 5:11 PM
Raul Ramirez
Raul Ramirez - avatar
+ 2
here u created three constructors which name is Cpp and constructor will execute while object creation so first your default constructor will be call then u have written one parameterized constructor and u haven't called anywhere that's why it won't be printed on the screen after that's destructor will be executed.
25th Feb 2022, 5:13 PM
A S Raghuvanshi
A S Raghuvanshi - avatar