高等继续教育 / 面向对象程序设计
正确率:推荐%
题型描述: 简答题
写出下面程序的执行结果:
#include<iostream>
using namespace std;
class B{
protected:
int b;
public :
B(int i){b=i+50;show( );}
B( ){}
virtual void show( ){cout<<"B::show( ) is called. b="<<b<<endl;}
};
class D:public B{
protected:
int d;
public :
D(int i):B(i){d=i+100;show( );}
D( ){}
void show( ){cout<<"D::show( )is called. d="<<d<<endl;}
};
int main( ){D d1(108); return 0;}
参考答案:
佳题速递: