What is the output of the following program? Carefully note the placement of the virtual keyword. Elass Pet{ public: Pet

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

What is the output of the following program? Carefully note the placement of the virtual keyword. Elass Pet{ public: Pet

Post by answerhappygod »

What Is The Output Of The Following Program Carefully Note The Placement Of The Virtual Keyword Elass Pet Public Pet 1
What Is The Output Of The Following Program Carefully Note The Placement Of The Virtual Keyword Elass Pet Public Pet 1 (65.14 KiB) Viewed 19 times
What is the output of the following program? Carefully note the placement of the virtual keyword. Elass Pet{ public: Pet(string n = ***) : name(n){} virtual Pet(){cout<< "Pet dtor"<<endl;} protected: string name; class Dog : public Pet{ public: Dog(string n = "") : Pet(n){} virtual Dog(){cout<<"Dog dtor"<<endl;} int main() { Dog rex("Rex"); Pet& p1 - rex; Pet* p2 - &rex; return; Dog dtor Dog dtor Pet dtor Pet dtor None of these. Pet dtor Dog dtor O Dog dtor Pet dtor
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply