πŸ“Š C++
Q. Find the output of below program.
Code:
#include <iostream>
using namespace std;

class X
{
public: X()
        { cout<<"X"; }
        ~X()
        { cout<<"~X"; }
};

class Y : public X
{
public: Y()
        { cout<<"Y"; }
        ~Y()
        { cout<<"~Y"; }
};

int main()
{
    Y obj;
    return 0;
}
  • (A) X~X~YY
  • (B) X~XY~Y
  • (C) XY~Y~X
  • (D) XY~X~Y
πŸ’¬ Discuss
βœ… Correct Answer: (C) XY~Y~X

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
336
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
88%
Success Rate