[求助]多太性问题
#include <iostream.h>class A
{
public :
void f()
{
cout<<"a.f"<<endl;
}
};
class B: public A
{
public :
virtual void f(){}
};
class C: public B
{
public :
virtual void f()
{
cout<<"C"<<endl;
}
};
void show (A*x)
{
x->f();
}
void main ()
{
A*a=new A;
show(a);
A*b=new B;
show (b);
A*c=new C;
show (c);
}
新手,帮忙解释下该程序哦~