首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类声明: class SAMPLE { int n; public: SAMPLE(int i=0):n(i){} void setValue(int n0); }; 下列关于getValue成员函数的实现中,正确的是( )。
有如下类声明: class SAMPLE { int n; public: SAMPLE(int i=0):n(i){} void setValue(int n0); }; 下列关于getValue成员函数的实现中,正确的是( )。
admin
2015-11-24
28
问题
有如下类声明:
class SAMPLE
{
int n;
public:
SAMPLE(int i=0):n(i){}
void setValue(int n0);
};
下列关于getValue成员函数的实现中,正确的是( )。
选项
A、SAMPLE::setValue(int n0){n=n0;}
B、void SAMPLE::setValue(int n0){n=n0;}
C、void setValue(int n0){n=n0;}
D、(int n0){n=n0;}
答案
B
解析
此题考查了成员函数的定义格式。在类外部对成员函数定义时的一般格式为:返回类型类名::成员函数名(参数表){函数体},故此题正确答案为选项B。
转载请注明原文地址:https://jikaoti.com/ti/PuE0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下定义语句:int a[]={1,2,3,4,5};,则对语句int*p=a;正确的描述是()。
一个类的友元函数或友元类能够通过成员操作符访问该类的()。
关于纯虚函数和抽象类的描述中,()是错误的。
实现输出为八进制的符号是()。
下列的各类函数中,()不是类的成员函数。
cin是()的一个对象,处理标准输入。
冒泡排序算法在最好的情况下的元素交换次数为【】。
在程序设计阶段应该采取【】和逐步求精的方法,把一个模块的功能逐步分解,细化为一系列具体的步骤,进而用某种程序设计语言写成程序。
数据库设计有两种方法,它们是()。
当要使用ostrstream流类定义一个流对象并联系一个字符串时,应在文件开始处使用#include命令,使之包含()文件。
随机试题
对痉挛患者采用的活动方式为
骨折引起脂肪栓塞综合征是由于
A.葶苈子B.杏仁C.白芥子D.黄药子E.苏子能止咳平喘,润肠通便,且无毒性的药物是()
A.皮肤枯槁,腠理疏松B.肌肉消瘦,软弱无力C.筋细无力,关节屈伸不力D.骨骼细小脆弱,或有畸形E.面唇色淡,脉弱
慢性菌痢的病程应该超过的时间是
下列不构成我国采取单一制的国家结构形式原因的是()。
对导游来说,控制自己的面部表情要注意()。
音乐是_________的一个重要领域。
①一个人的表情能改变容颜,特别是日积月累的表情,具有滴水穿石的效果②一个人的面容是先天生好的③你看那些老年夫妻,经过多年饮食和趣味的磨合,表情越来越趋相同,一颦一笑都相仿④这种美除了有姣好的面容作底子,更重要的是表情和气度在起作用⑤少年的美或许是惊
请比较卡特尔和巴尔特斯的智力划分理论。
最新回复
(
0
)