首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class AA { int a; public: int getRef()const{return&a;}//① int getValue()const{return a;}//②
有如下类定义: class AA { int a; public: int getRef()const{return&a;}//① int getValue()const{return a;}//②
admin
2020-06-29
19
问题
有如下类定义:
class AA
{
int a;
public:
int getRef()const{return&a;}//①
int getValue()const{return a;}//②
void set(int n)const{a=n;}//③
friend void show(AA aa)const{cout<
};
其中四个函数的定义中正确的是( )。
选项
A、①
B、②
C、③
D、④
答案
B
解析
本题考查常成员函数,常成员函数只能引用本类中的数据成员,而不能修改它。所以本题答案为B。
转载请注明原文地址:https://kaotiyun.com/show/vEyp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
使用VC6打开源程序文件modi3.cpp。此程序的功能是将outl.txt文件中的内容输出到屏幕与文件中。输出如下:李一1.78m21王一1.65m23out2.txt文件的内容如下:李一1.78m2
使用VC6打开考生文件夹下的源程序文件modil.cpp,—num:num:10#includeinti=10;C1assTestClass{public:TestClass(inti){cout
使用VC6打开考生文件夹下的源程序文件modi3.cpp,其中定义了用于表示日期的类Date,但类Date的定义并不完整,按要求完成下列操作,将类的定义补充完整。(1)定义私有成员变量year、month、day,分别表示年、月、日,类型为int。请在注
使用VC6打开考生文件夹下的源程序文件modil.cpp,该程序运行时有错,请改正其中的错误,使程序正常运行,并使程序的执行结果为:1234543211234321123
使用VC6打开考生文件夹下的源程序文件mo(1i2.cpp。阅读下列函数说明和代码,补充空出的代码。函数convert(char*des,char*str)的功能是去掉字符串str中相同的字母,并将处理后的结果存到des所指的字符串中。例如:输入:
有如下头文件:intf1();staticintf2();classMA{public:intf3();staticintf4();};在所描述的函数中,具有隐含的this指针的是()。
设循环队列为Q(1:m),其初始状态为front=rear=m。经过一系列入队与退队运算后,front=30,rear=10。现要在该循环队列中作顺序查找,最坏情况下需要比较的次数为
在定义一个类模板时,模板形参表是用一对括号括起来的,所采用的括号是
下列枚举类型的定义中,包含枚举值3的是
下列关于this指针的叙述中,正确的是()。
随机试题
某市环保局应当地居民的举报对排放烟尘超标的某化工厂作出了处罚5万元的行政处罚,并责令其限期整改。化工厂对环保局的行政处罚决定不服,向法院提起诉讼。诉讼期间,原告找到被告要求协商解决,被告同意,遂变更了原来的处罚决定,对原告只加收两倍的排污费。原告向法院申请
神经递质的信息传递方式A.突触分泌B.旁分泌C.内分泌D.自分泌E.外分泌
企业的加权平均资本成本指的是
甲公司2015年发现2013年有笔实际资产损失10万元在当年未扣除,已知甲公司2013年应纳税所得额为8万元,2014年应纳税所得额为3万元,2015年应纳税所得额为12万元,甲公司将上述损失在2015年进行资产损失申报,该公司2015年实际应缴纳的企业所
现有关系表:学生(宿舍编号,宿舍地址,学号,姓名,性别,专业,出生日期),它的主键是()。
不仅人上了年纪会难以集中注意力,就连蜘蛛也有类似的情况。年轻蜘蛛结的网整齐均匀,角度完美;年老蜘蛛结的网可能出现缺口,形状怪异。蜘蛛越老,结的网就越没有章法。科学家由此认为,随着时间的流逝,这种动物的大脑也会像人脑一样退化。以下哪项如果为真,最能质疑科学家
Inmostcultures,whenyoumeetacquaintancesforthefirsttimeduringaday,itisnormaltogreetthem.Themainpurposeoft
WhatdidHelenrecentlypass?
Somefindingsareissuedrecentlyaboutattendingacommunitycollege.Mostworkerswhohavea【C1】______fromacommunitycollege
A--trafficregulationB--guidepostC--trafficlightD--trafficpoliceE--safet
最新回复
(
0
)