首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类声明: 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
2021-06-10
34
问题
有如下类声明:
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://jikaoti.com/ti/8Ch0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下类定义:classPoint{intx_,y_;public:Point():x_(0),y_(0){}Point(intx,inty=0):x_(x),y_(y){}};
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是()。
函数swap(a,n)可完成对a数组从第1个元素到第n个元素两两交换。其中b[0]=1;b[1]=2;swap(h,2)。在运行调用函数中的语句后,b[0]和b[1]的值分别为()。
在结构化程序设计中,模块划分的原则是()。
打开文件时可单独或组合使用下列文件打开模式()。①ios_base::app②ios_base::binary③ios_base::in④ios_base::out若要以二进制读方式打开一个文件,需使用的文件打开模式为
有如下函数模板:template<classT>Tsquare(Tx){returnx*x;)其中T是()。
使用VC6打开考生文件夹下的源程序文件modi3.cpp,通过把类Distance定义为类Point的友元类,来实现计算两点之间距离的功能。其中定义的类并不完整,按要求完成下列操作,将类的定义补充完整。(1)把类CDistance定义为类CPoint的友
下列有关运算符重载的叙述中,正确的是()。
数据库系统的核心是()。
数据结构主要研究的是数据的逻辑结构、数据的运算和()。
随机试题
在下列小儿原发性肺结核的叙述中哪项不对
(2012年)境外某电子产品制造公司为扩展中国业务,2011年初设立上海代表处作为常驻代表机构,主要从事与总公司产品销售、境内采购有关的联络活动以及中国市场调查、展示活动。2012年6月,主管税务机关进行税务检查时发现代表处账簿设置不健全,收入无法查实,但
下列名僧中,属于唐代的有()。
为了挽救清政府的统治危机,封建统治阶级中的部分成员如奕诉、曾国藩、李鸿章、左宗棠、张之洞等洋务派官员兴办洋务事业。下列不是洋务派兴办的洋务事业的是()。
小王从家开车上班,其实行驶10分钟后发生了故障,小王从后备箱中取出自行车继续赶路,由于自行车的车速只有汽车的,小王比预计时间晚了20分钟到达单位,如果汽车再多行驶6公里,他就能少迟到10分钟,从小王家到单位的距离是()公里。
一国货币升值对其进出口业务产生的影响是()。
Heistooyoungtobeableto______betweenrightandwrong.
无符号二进制整数1000010转换成十进制数是()。
WhichofthefollowingCANNOTbeusedasanominalsubstitute(名词替代词)?
HowMarketersTargetKidsA)Kidsrepresentanimportantdemographictomarketersbecausetheyhavetheirownpurchasingpower,t
最新回复
(
0
)