问题
填空题
以下程序的执行结果是 【14】 。 #include<iostream> using namespace std; class base { public: virmal void who(){cout<<"Base Class"<<endl;) }; class Derivedl:public Base { public: virtual void who(){cout<<"Derivedl Class"<<endl;} }; class derived2:public Base { public: virtual void who(){cout<<"Derived2 Class"<<endl;) }; int main(int argc,char*argv[]) { base obj1,*P; deliVedl obj2; derived2 obj3; p=&obj1; p->who(); p=&obj2; p->who(); p=&obj3; p->who(); return 0; }
答案
参考答案:Base Class
解析:Derivedl Class Derived2 Class