首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类声明: class SAMPLE { int n; public: SAMPLE(int i=0):n(i){} void setValue(int n0); }; 下列关于getVa
有如下类声明: class SAMPLE { int n; public: SAMPLE(int i=0):n(i){} void setValue(int n0); }; 下列关于getVa
admin
2021-09-05
26
问题
有如下类声明:
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、setValue(int n0){n=n0;}
答案
B
解析
本题考查在类外定义类的成员函数,需要使用作用域限定符“::”,属于基础知识,本题答案为B。
转载请注明原文地址:https://kaotiyun.com/show/no5p777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下程序:#includeusingnamespacestd;classA{public:virtualvoidfuncl(){cout
下列字符串中不能作为C++标识符使用的是()。
下列关于模板的叙述中,错误的是()。
关于new运算符的下列描述中,错误的是()。
有如下类声明:classMyBASE{intk;public:voidset(intn){k=n;}intget()const{returnk;}};classMyDERIVED:protectedMyBASE{prot
若有函数模板mySwap和一些变量定义如下:()。templatevoidmySwap(TX,Ty);doubledl,d2;intil,i2;下列对mySwap的调用中,错误的是
数据库应用系统中的核心问题是()。
设树T的深度为4,其中度为1,2,3,4的结点个数分别为4,2,1,1。则T中的叶子结点数为()。
数据流图中带有箭头的线段表示的是()。
在关系数据库中,用来表示实体间联系的是
随机试题
Afamousteacherwasspeakingtothestudentsatourschool.Hebeganhislessonbyholdingupa¥100bill.Thenhesaidtothe
这个标志是何含义?
转动设备运转之前必须()。
剂型可以按以下哪些种方法分类
下列关于征收土地的表述中,正确的是()。
Inthiscase,wewerecompelledtocancelthecontract,ratherthanlodgingapenaltyagainstyou.
Brazilhasbecomeoneofthedevelopingworld’sgreatsuccessesatreducingpopulationgrowth—butmorebyaccidentthandesign.
在一个2×3的完全随机设计中,若每种处理使用6名被试,整个实验设计需使用的被试数是()
依法治国的根本保证是()
关系表中的每一横行称为一个
最新回复
(
0
)