class A{public:void f1(){cout << "A.f1()" << endl;}
void f(){f1();//f3();}};class B:public A{void f1(){cout << "B.f1()" << endl;}void f3(){cout << "B.f3()" << endl;}};
B b;b.f();输出为A.f1(),也就是说执行的是基类中的f1()函数。如果python中实现相同的代码如下:class A:def f1(self):print "A.f1";def f(self):self.f1();#self.f3();...