以下程序的执行结果是【 】。 #include<iostream> using namespace std; class base { public: virmal void who(){cout<<"Base Cla

admin2013-02-27  25

问题 以下程序的执行结果是【  】。
   #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

解析
转载请注明原文地址:https://jikaoti.com/ti/CuL0FFFM
0

最新回复(0)