class A
{
public:
void virtual print(){cout<<"A::print()"<< endl;}
};
class B :public A
{
public:
static void print(){cout<<"C::print()"<< endl;}
};
{
public:
void virtual print(){cout<<"A::print()"<<
};
class B :public A
{
public:
static void print(){cout<<"C::print()"<<
};
void main()
{
A a,*aa,*ab;
B b;
aa=&a;
ab=&b;
aa->print();
ab->print();
}
ab->print();
}
输出:
A::print()
A::print()