首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的执行结果是( )。 #include<iostream.h> #include<stdlib.h> class TestClass { public: intx,y; T
下列程序的执行结果是( )。 #include<iostream.h> #include<stdlib.h> class TestClass { public: intx,y; T
admin
2013-05-30
22
问题
下列程序的执行结果是( )。 #include<iostream.h> #include<stdlib.h> class TestClass { public: intx,y; TestClass(){x=y=0;} TestClass(int a,int b){x=a;y=b;} void disp() { cout<<"X"="<<X<<",y="<<y<<endl; }
选项
A、x=2,y=2
B、x=3,y=3
C、x=2,y=3
D、x=3,y=2
答案
C
解析
由主函数入手,定义了类TestClass的对象s1(2,3),当类对象进入其作用域时调用构造函数,构造函数应该是调用具有参数的“TestClass(int a,int b)<x=a;y=b;)”。然后引用成员函数disp(),则输出为“cout<<”x=“<<x<<”,y=“<<y<<endl;”。即x=2,y=3。
转载请注明原文地址:https://jikaoti.com/ti/y6E0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
在下列关于关系的陈述中,错误的是______。
已知:inta,b;下列switch语句中,()是正确的。
设有关系R和S,关系代数表达式为R-(R-S)表示的是()。
数据库系统依赖于()支持数据独立性。
下列运算符不能在C++中重载的是()。
在整型指针变量ptr1、ptr12的定义中,错误的是______。
若有以下定义:chars(10)="program",t[]="test";则下列选项中对字符串操作错误的是()。
结构化程序设计方法的主要原理的是【】。
以下不属于运算符重载应注意的问题是()。
利用继承能够实现【】。这种实现缩短了程序的开发时间,促使开发人员复用已经测试和调试好的高质量软件。
随机试题
根据以下资料,回答问题。2020年,H省秋粮玉米和稻谷的市场平均交易价格分别为2.34元/公斤和2.74元/公斤,分别比上年上涨28.6%和8.7%。按此价格测算,2020年全省农户种植玉米、稻谷扣除成本前的产值分别为957.1元/亩、1520.7元/
肺结核并发肺不张最常见原因
不符合猩红热特点的是
下列项目属于单位工程的是()。
下列说法中正确的是()。根据《合同法》规定,下列给出了有关缔约过失责任的构成要件,其中不包括()。
()是指根据交易或者事项的经济特征所确定的财务会计对象的基本分类。
党要管党,主要包括()。
2017年2月22日,最高人民法院修订的《最高人民法院关丁庭审活动录音录像的若干规定》指出,法院将把()引入庭审记录。法院应当在法庭内配备固定或者移动的录音录像设备。
下列关于“法律与道德的区别”的论述中,不正确的是()。
在虚拟页式存储管理系统中,选择页面淘汰算法时应尽量注意减少或避免______现象的发生。
最新回复
(
0
)