题目内容
以下程序的执行结果是【 】。
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;
}
查看答案
搜索结果不匹配?点我反馈
更多问题