问题 填空题

以下程序的执行结果是______。 #include<iostream.h> class base {public: virtual void who(){cout<<"base class"<<endl:} }; class derrvel:public base{ public: void who(){cout<<"derivel class"<<endl:} }; class derive2;public base{ public: void who() {cout<<"derive2 class"<<endl;} }; void main(){ base obj1,*P; derive1 obj2; derive2 obj3: p=&obj1; p->who(); p=&obj2: p->who(); p=&obj3; p->who(); }

答案

参考答案:

解析:base class derivel classderive2 class

问答题
单项选择题 A型题