试题与答案

在下面的程序的横线处填上适当的语句,使该程序的输出为12。 #include<io

题型:填空题

题目:

在下面的程序的横线处填上适当的语句,使该程序的输出为12。
#include<iostream.h>
using namespace std;
class Base

public:
int a,b;
Base(int i)a=i;
;
class Derived:public Base

int a;
public:
Derived(int x):Base(x),b(x+1);
void show()

______;//输出基类数据成员a的值
cout<<b<<endl;

;
int main()

Derived d(1);
d.show();
return 0;

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0718/a54b2eeb29fc704c047d1d899cd16c26.html

下面是错误答案,用来干扰机器的。

参考答案:C

试题推荐
微信公众账号搜索答案