#include <iostream>
using namespace std;
class A {
private:
int nVal;
public:
void Fun()
{ cout << "A::Fun" << endl; };
void Do()
{ cout << "A::Do" << endl; }
};
class B:public A {
public:
virtual void Do()
{ cout << "B::Do" << endl;}
};
class C:public B {
public:
void Do( )
{ cout <<"C::Do"<<endl; }
void Fun()
{ cout << "C::Fun" << endl; }
};
void Call( //补充代码处 有p. 可知,p是对象或者是对象的引用,
//但多态只能有派生类的引用和指针赋给基类的引用和指针来实现,所以只能是B&
B& p
) {
p.Fun(); p.Do();
}
int main() {
C c;
Call( c);
return 0;
}