首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类声明: 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
2017-04-25
52
问题
有如下类声明:
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://kaotiyun.com/show/JmAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
已知程序中已经定义了函数test,其原型是inttest(int,int,int);,则下列重载形式中正确的是
下列程序用于将源文件中的字母进行大小写转换,while的条件是【 】。#include<iostream.h>#include<fstream.h>#include<iomanip.h>void
有如下程序:#include<iostream>usingnamespacestd;classTestClass{protected:TestClass(){cout<<’x’;}TestClass(ch
下列程序的运行结果是( )。 #include<iostream.h> voidfun(int &a,int b=3) { static int i=2; a=a+b+i; i=i+a; } void ma
有如下程序: #include<iostream> using namespace std; class VAC{ public: int f() const{return 3;} int f() {
以下程序的执行结果是______。#include<iostream.h>classA{inta:public:voidseta(intx){a=x;}voidshowa(){cou
以下程序的正确运行结果是()。#include<iostream.h>intf(int);voidmain(){inta=2,i;for(i=0;i<3;i++)cout<<f(a)<<"";
关于new运算符的错误的描述是()。
假定用户没有给一个名为MyClass的类定义析构函数,则系统为其定义的默认析构函数首部形式为______。
若需要把一个函数"void Func();"定义为一个类Sample的友元函数,则应在类 Sample的定义中加入一条语句【 】。
随机试题
下列有关存储器读写速度的顺序,正确的是( )。
证券公司操纵市场的行为会扰乱正常的( ),从而造成证券价格异常波动。
远期净敞口头寸的数量等于卖出的远期合约头寸减去买入的远期合约头寸。()
中国公民李四是一外商投资企业的中方雇员,2005年收入情况如下:(1)1~12月份每月取得由雇佣单位支付的工资、薪金15000元;(2)1-12月份每月取得由派遣单位支付的工资、薪金2500元;(3)4月份一次性取得稿费收入8
根据以下资料。回答下列问题。工业烟尘排放量占烟尘排放总量的比重最低的年份是:
伤心对于()相当于悲痛对于()
唐代对一品至九品的官员实行考课的标准是“四善二十七最”,其中的“四善”是指()。
______hotweathermaycauseserioushealthproblemsassociatedwithairpollution?______therewerecontroversiesontheissue
Newtechnologylinkstheworldasneverbefore.Ourplanethasshrunk.It’snowa"globlevillage"wherecountriesareonlyseco
Giventhechoicebetweenspendinganeveningwithfriendsandtakingextratimeforhisschool-work,AndyKliseadmitshewould
最新回复
(
0
)