首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序: #include<iostream> using namespace std; class TestClass 1 { public: TestClass1() { X=0; }
若有以下程序: #include<iostream> using namespace std; class TestClass 1 { public: TestClass1() { X=0; }
admin
2012-01-20
52
问题
若有以下程序:
#include<iostream>
using namespace std;
class TestClass 1
{
public:
TestClass1()
{
X=0;
}
int x;
};
class TestClass2:virtual public TestClass1
{
public:
TestClass2()
{
x=10;
}
};
class TestClass3:virtual public TestClass 1
{
public:
TestClass3()
{
x=20;
}
};
class TestClass4:public TestClass2, protected TestClass3
{ };
int main()
{
TestClass4 obj;
cout<<obj.x<<end1;
return 0:
}
该程序运行后的输出结果是______。
选项
答案
20
解析
转载请注明原文地址:https://kaotiyun.com/show/HJVp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
若有定义语句:intx=12,y=8,z;在其后执行语句z=0.9+x/y则z的值为()。
若在定义语句:inta,b,c,*p=&c;之后,接着执行以下选项中的语句,则能正确执行的语句是()。
以下语句定义正确的是()。
下列错误的定义是()。
在数据库系统的组织结构中,下列()映射把用户数据库与概念数据库联系了起来。
给定程序中,函数fun的功能是:调用随机函数产生20个互不相同的整数放在形参a所指数组中(此数组在主函数中已置0)。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:部分源程序在文件BLANK1.C中
下列排序方法中,最坏情况下比较次数最少的是()。
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是()。
若有定义:inta=7;floatx=2.5,y=4.7;则表达式“x+a%3*(int)(x+y)%2/4”的值是()。
关于运算符重载,下列表述中正确的是()。
随机试题
设二维随机变量(X,Y)的概率密度为求(X,Y)关于X,Y的边缘概率密度fX(x),fY(y).
当今时代的主题是()。
A、TheActivitiestakelesstime.B、TheActivitiesaretobedoneinclass.C、FewinstructionsaregivenfortheActivities.D、St
一般脑血栓患者,早期进行患肢功能锻炼宜在发病后几天进行
患者,女,44岁。餐后突发上腹刀绞样疼痛,阵发性加重,伴腰部放射、恶心,呕吐胃内容物。为明确诊断应首先选择的检查是
“师夷长技以制夷”出自魏源编写的()。
影响自尊的因素有()。
在数据库系统中,数据的最小访问单位是______。
Fewcreationsofbigtechnologycapturetheimaginationlikegiantdams.Perhapsitishumankind’slongsufferingatthemercyo
A、Puthisnotesinorderahead.B、Askhimselfalotofquestions.C、Knowhisownneedsandwants.D、Figureoutwhathisaudience
最新回复
(
0
)