-
What is the output of this program?
#include <iostream>
using namespace std;
class BaseClass
{
public:
BaseClass( )
{
cout << "I ";
}
~BaseClass ( )
{
cout << " Mania";
}
};
class DerivedClass : public BaseClass
{
public:
DerivedClass ( )
{
cout << "Love ";
}
~DerivedClass ( )
{
cout << "Interview";
}
};
int main( )
{
DerivedClass x;
}
-
- I
- Love
- Interview
- Mania
- I Love Interview Mania
Correct Option: E
In this program, We are printing the order of execution of constructor and destructor in the class.