首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的输出结果是 #include<iostream.h> class Myclass{ public : Myclass( int i=0,int j=0) {x=i;
下列程序的输出结果是 #include<iostream.h> class Myclass{ public : Myclass( int i=0,int j=0) {x=i;
admin
2010-03-29
27
问题
下列程序的输出结果是 #include<iostream.h> class Myclass{ public : Myclass( int i=0,int j=0) {x=i; y=j; } void show( ){cout<<"x="<<x<<" "<"y="<<y<<endl;} void show( )const{cout<<"x="<
选项
A、x=4,y=3;x=7,y=8
B、x=3,y=4;x=7,y=8
C、x=7,y=8;x=4,y=3
D、x=8,y=7;x=7,y=8
答案
1
解析
在Myclass类中定义了两个同名函数show,其中一个是常成员函数。在main函数中定义了两个对象myl,my2,其中对象my2是常对象。这两个对象调用成员函数show时,通过对象myl调用的是没有用const修饰的一般成员函数,而通过对象my2调用的是const修饰的常成员函数。
转载请注明原文地址:https://kaotiyun.com/show/eLjp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序main(){intx=1,y=0,a=0,b=0switch(x){case1:switch(y){case0:a++;break;case1:b++;break;}
数据模型的三个要素是()。
设有定义:structcomplex{intreal,unreal;}data1={1,8},data2;则以下赋值语句中错误的是
已有定义:charc;,程序前面已在命令中包含ctype.h文件。不能用于判断c中的字符是否为大写字母的表达式是
若以下选项中的变量a,b,y均已正确定义并赋值,则语法正确的switch语句是
有下列程序:#include<stdio.h>/*fun函数的功能是将a所指数组元素从大到小排序*/voidfun(int*a,intn)main(){intt,i,j;{intc[10]={1,2,3,4,5,6,7,8,9,0}
下面属于黑盒测试方法的是()。
软件按功能可以分为:应用软件、系统软件和支撑软件(或工具软件)。下面属于应用软件的是()。
设数据元素的集合D={1,2,3,4,5},则满足下列关系R的数据结构中为线性结构的是()。
在一个长度为n的线性表中插入一个元素,最好情况下需要移动的数据元素数目
随机试题
[A]Itmayseemsillythatascavengerhuntforcartoonmonstersisthebeginningofanewworld,butfewareabletopredict
深呼吸时两肺下缘可向上下各移动多大范围
性味苦寒的药物大多具有的功效是
休克性肺炎最基本的抗休克措施是
某城市商业银行在合并多家城市信用社的基础上设立,其资产质量差,经营队伍弱,长期以来资本充足率、资产流动性、存贷款比例等指标均不能达到监管标准。请根据有关法律规定,回答下列问题。在作出对该银行的行政处置决定后,负责处置的机构对该银行的人员采取了以
根据《统计法》规定,地方各级人民政府统计机构可以制定地方统计标准,报上一级统计机构审批。()
吸食、注射毒品成瘾人员是怀孕或者哺乳自己未满一周岁婴儿的妇女,或者患有某些严重疾病的,不宜收入强制戒毒所,应当限期在强制戒毒所外戒毒,由其()负责监督、管理。
小徐将10万元的定期存款单出质给小郭,借款8万元,双方签订了质押合同,但小徐未按时交付存款单。则下列说法正确的是()。
(2012年浙江.材料二)根据以下资料,回答下列问题。2007—2010年,浙江省第一产业的增加值大于1000亿元的年份有()。
A.EffectsofACEandACEInhibitorsB.WideUseofACEInhibitorsC.HowtoDealwithHighBloodPressureinPregnantWomenD.
最新回复
(
0
)