#include<iostream> using namespace std; class Base{ public: virtual void show(int i=10){ cout<<"Base show i="<<i<<endl; } virtual ~Base(){} }; class Derived:public Base{ public: virtual void show(int i=20){ cout<<"Derived show i="<<i<<endl; } virtual ~Derived(){} }; int main(){ Base* bp=new Derived(); bp->show(); }
以上这段程序的输出结果为?
答案不是Derived show i=20,也不是Base show i=10
欲知正确答案,请自行验证。