鉴于以下代码段,
class Base { public: virtual void eval() const { std::cout<<"Base Const Eval\n"; } }; class Derived:public Base { public: void eval() { std::cout<<"Derived Non-Const Eval\n"; } }; int main() { Derived d; Base* pB=&d; pB->eval(); //This will call the Base eval() return 0; }
为什么pB-> eval()会调用Base :: eval()?
谢谢