首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: 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-05-14
26
问题
有如下类定义:
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{tout<
};
其中四个函数的定义中正确的是( )。
选项
A、①
B、②
C、③
D、④
答案
B
解析
本题考查常成员函数,常成员函数只能引用本类中的数据成员,而不能修改它。所以本题答案为B。
转载请注明原文地址:https://jikaoti.com/ti/MQA0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下面的说法中错误的是()。
A、 B、 C、 D、 D如果派生类私有继承基类,不能访问基类中的私有成员,所以A)、B)是错误的。派生类是对基类的具体化,所以c)错误的。如果派生类没有实现基类的一个纯虚函数,则该派生类是一个抽象类,即选择
关于continue语句叙述不正确的是
要定义一个具有5个元素的一维数组vect,并使其各元素的初值依次是30,50,-88,0和0,则下列定义语句中错误的是()。
下面关于虚函数的表述中正确的是()。
关于关键字class和typename,下列描述正确的是()。
C++语言提供的基本控制结构可以分为3种类型:顺序结构、【】和循环结构。
已知数据表A中每个元素距其最终位置不远,为节省时间,应采用的算法是
软件是程序、数据和______________的集合。
随机试题
冗余
产品瑕疵致人损害的民事责任的归责原则是()
施工平行承发包模式的弱点是(),限制了施工平行承发包模式在某些建设项目上的应用。
税款征收的方式包括()。
下列关于行政诉讼的说法中正确的有()。
下列诗句所描写的景致,属于同一个城市的是()。
抗体保健中心进行了为期20周的减肥实验。结果显示,参加者平均减肥10千克。其中,男性参加者平均减肥14千克,女性参加者平均减肥8千克。如果以上陈述是真的,并且其中统计数据是精确的,则以下哪项也一定是真的?()
如图,长方形区域ABCD,AB=3米,AD=8米,AF=FE=ED,则阴影部分的面积为:
Thefarmerwaswordedabout______.Whotakesthepillsatlast?
Althoughtheenjoymentofcolorisuniversalandcolortheoryhasallkindsofnamestoit,colorremainsaveryemotionalands
最新回复
(
0
)