首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Test { public: Test(){a=0;C=0;} ∥① int f(int a)const{this.>a:a;} ∥② static int g(){r
有如下类定义: class Test { public: Test(){a=0;C=0;} ∥① int f(int a)const{this.>a:a;} ∥② static int g(){r
admin
2020-07-30
17
问题
有如下类定义:
class Test
{
public:
Test(){a=0;C=0;} ∥①
int f(int a)const{this.>a:a;} ∥②
static int g(){return a;) ∥③
void h(int b){Test::b=b;}; ∥④
private:
int a;
static int b;
const int c;
);
int Test::b=0:
在标注号码的行中,能被正确编译的是( )。
选项
A、①
B、②
C、③
D、④
答案
D
解析
此题考查的是类的定义。一个类的长数据成员的初始化只能在成员初始化列表中进行,故选项A错误;常成员函数不能更新对象的数据成员,故选项B错误;静态成员函数可以直接访问类中说明的静态成员,但不能直接访问类中说明的非静态成员,故选项C错误。
转载请注明原文地址:https://kaotiyun.com/show/FTyp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下类声明:classWhy{intn;public:doubled;protected:longl;floatf;
某二叉树中有15个度为1的结点,16个度为2的结点,则该二叉树中总的结点数为
下列关于运算符重载的叙述中,正确的是
已知一运算符函数没有参数。下列关于该运算符函数的表述中错误的是
下面不属于软件需求分析阶段主要工作的是
运算符重载是对已有的运算符赋予多重含义,因此()。
在下面的类定义中,错误的语句是()。classSample{public:Sample(intval);‖①—Sample();‖②private:inta=2.5
数据结构主要研究的是数据的逻辑结构、数据的运算和()。
下列模式中,能够给出数据库物理存储结构与物理存取方法的是()。
一棵二叉树中共有80个叶子结点与70个度为1的结点,则该二叉树中的总结点数为()。
随机试题
不宜冷藏的细菌是
患者,女性,36岁。近一段时间出现不规则阴道出血,经量增多,并感到阴道排液也增多,并有恶臭。建议作
新建项目的分项工程质量评定中,关键实测项目的合格率不应低于90%,机电工程的合格率不应低于95%。()
当路基压实度因含水量过大而达不到要求时,应继续碾压。()
以下选项中关于设备制造过程的持续改进叙述正确的是( )。
根据《水利工程质量监督管理规定》(水建[1997]339号),工程质量监督机构监督检查和认定()的划分。
简述格式条款的概念和我国合同法对格式条款的法律要求。
老张、老王、老李、老赵四人的职业分别是司机、教授、医生、工人。老张比教授个子高。老李比老王个子矮。工人比司机个子高。医生比教授个子矮。工人不是老赵就是老李。根据以上条件,可推出以下哪项?
打开工作簿文件Excel.xlsx,将工作表Sheet1的A1:F1单元格合并为一个单元格,内容水平居中,计算“总计”行和“合计”列单元格的内容,将工作表命名为“商品销售数量情况表”。
Withthepossibleexceptionofequalrights,perhapsthemost【C1】______issueacrosstheUnitedStatestodayisthedeathpenalty
最新回复
(
0
)