Question: What will be the output of the following program?
#include
class A
{
public:
void BixFunction(void)
{
cout<< "Class A" << endl;
}
};
class B: public A
{
public:
void BixFunction(void)
{
cout<< "Class B" << endl;
}
};
class C : public B
{
public:
void BixFunction(void)
{
cout<< "Class C" << endl;
}
};
int main()
{
A *ptr;
B objB;
ptr = &objB;
ptr = new C();
ptr->BixFunction();
return 0;
}
[A].Class A.
[B].Class B.
[C].Class C.
[D].The program will report compile time error.
Answer: Option A