试题与答案

使用VC6打开考生文件夹下的工程test26_1,此工程包含一个源程序文件test2

题型:填空题

题目:

使用VC6打开考生文件夹下的工程test26_1,此工程包含一个源程序文件test26_1.cpp,但该程序运行有问题,请改正
函数中的错误,使该程序的输出结果为:
Values are: 1,2 and 3
源程序文件test26_1.cpp清单如下;
#include <iostream.h>
class CommonBase

public:
int x;
;
/*****************found*****************/
class DeriveCommonA::public CommonBase

public:
int y;
;
class DeriveCommonB:public CommonBase

public:
int z;
;
/*****************found*****************/
class Overlapping:public DeriveCommonA; public DeriveCommonB

public:
void Display()

cout<<"Values are: "<<DeriveCommonA::x<<", "<<y<<" and "<<z<<end1;

;
int main ( )

Overlapping ov;
/*****************found*****************/
ov.x=1;
ov.y=2;
ov.z=3;
ov.Display();
return 0;

答案:

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

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

参考答案:A

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