class A
{
public:
virtual void act1();
void act2()
{act1();}
};
void A::act1()
{
cout<<"A::act1() called."<<endl;
}
class B:public A
{
public:
void act1();
};
void B::act1()
{
cout<<"B::act1() called."<<endl;
}
int main()
{
B b;
b.act2();
system("pause");
}
比如这个例子- -虽然我知道二义性已消除= =但是计算机这时怎么知道该选哪个函数? |