Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the output of this program? #include using namespace std; class myclass

ID: 3794099 • Letter: W

Question

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;}

Explanation / Answer

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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote