Question: What will be the output of the following program?
#include
class BixBase
{
public:
BixBase()
{
cout<< "Base OK. ";
}
virtual ~BixBase()
{
cout<< "Base DEL. ";
}
};
class BixDerived: public BixBase
{
public:
BixDerived()
{
cout<< "Derived OK. ";
}
~BixDerived()
{
cout<< "Derived DEL. ";
}
};
int main()
{
BixBase *basePtr = new BixDerived();
delete basePtr;
return 0;
}
[A].Base OK. Derived OK.
[B].Base OK. Derived OK. Base DEL.
[C].Base OK. Derived OK. Derived DEL.
[D].Base OK. Derived OK. Derived DEL. Base DEL.
Answer: Option D