#include <iostream.h>
class A{
public:
virtual void printMe(){cout<<"This is class A printing. "<<endl;};
} ;
class B:public A{
public:
void printMe() {cout << "This is class B printing. "<<endl;}
} ;
class C:public B{
public:
void printMe() {cout <<"This is class C printing. "<<endl;}
} ;
void print(A a)
{
a.printMe();
}
void main()
{
B b;
C c;
print(b);print(c);
}
THIS IS CLASS A PRINTING.
THIS IS CLASS A PRINTING.