What is the output of this program include using namespace s

What is the output of this program? #include using namespace std; class myclass {public: int who; myclass(int id); Tilde myclass();) *pglo_ob1, *pglo_ob2; myclass::myclass(int id) {cout NestedLessLess \"\ constructor:\" NestedLessLess end1; cout NestedLessLess \"Initializing an obj with id =\" NestedLessLess id NestedLessLess \"; who = \" NestedLessLess id NestedLessLess endl; who = id;} myclass:: Tilde myclass() {cout NestedLessLess \"Destructing the obj. with who =\" NestedLessLess who NestedLessLess endl;} void f() {cout NestedLessLess \"\ entering f()\"NestedLessLess endl; myclass *plocal_ob3 = new myclass(700); cout NestedLessLess \"\ leaving f()\"NestedLessLess endl;} int main() {myclass local_ob1(10); f();//function call myclass *plocal_ob2 = new mydass(20); pglo_ob1 = new myclass(400); pglo_ob2 = new myclass(800); delete plocal_ob2; delete pglo_ob2; cout NestedLessLess end1; return 0;}

Solution

The Output is


constructor

Initializing an object with id= 10;who = 10

Entering f()

constructor

Initializing an object with id= 700;who = 700

leaving f()

constructor

Initializing an object with id= 200;who = 200

constructor

Initializing an object with id= 400;who = 400

constructor

Initializing an object with id= 800;who = 800

Destructing the object with who = 200

Destructing the object with who = 800

Destructiong the object with who = 10


Thanks, let me know if there is any concern/doubt.

 What is the output of this program? #include using namespace std; class myclass {public: int who; myclass(int id); Tilde myclass();) *pglo_ob1, *pglo_ob2; mycl

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site