Predict the output of the followiing program.


			  		

Loading

โœช Choose the correct option.

Predict the output of the followiing program.

#include 
using namespace std;

class A
{
public:
virtual void fun() { cout << "A::fun() "; }
};

class B: public A
{
public:
void fun() { cout << "B::fun() "; }
};

class C: public B
{
public:
void fun() { cout << "C::fun() "; }
};

int main()
{
B *bp = new C;
bp->fun();
return 0;
}

A. B::fun()
B. A::fun()
C. c::fun()
D. compiler error

Leave a Comment