首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Sample{ public; Sample(int x):ref(x){} //① private: Sample():ref(0){} //② sta
有如下类定义: class Sample{ public; Sample(int x):ref(x){} //① private: Sample():ref(0){} //② sta
admin
2016-11-25
27
问题
有如下类定义:
class Sample{
public;
Sample(int x):ref(x){} //①
private:
Sample():ref(0){} //②
static int val=5; //③
const int ref; //④
};
上述程序段中,错误的语句是( )。
选项
A、①
B、②
C、③
D、④
答案
C
解析
静态整型数据不能定义为类的数据成员。
转载请注明原文地址:https://kaotiyun.com/show/bEAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
已知有定义constintD=5;inti=1;doublef=0.32;charc=15;则下列选项错误的是
执行语句序列ofstreamoutfile("data.dat");if(…)cout<<"ok";elsecout<<"fail";后,如果文件打开成功,显示“ok”,否则显示“fail”。由此可知,上面if语句的“…”
下列数组的定义中,会产生错误的是
()是以一种完全通用的方法来设计函数或类而不必预先说明将被使用的每个对象的类型。
如果类中的一个成员函数的定义实现在类内,则该函数系统自动默认为该类的【】函数。
以下程序的执行结果为【】。#include<iostream>usingnamespacestd;classbase{public:virtualvoidwho()
以下程序执行后的输出结果是()。#include<iostream.h>classBasel{public:voidfun(){cout<<"Basel"<<end1;}};
关于成员函数特征的下述描述中,()是错误的。
下面关于C++语言变量的叙述错误的是()。
随机试题
曲面2x3-yez-ln(z+1)=0在点(1,2,0)处的切平面方程为_______.
吴××,男,16岁,因“发热、咽痛8天,心悸2天”就诊。发热时有心悸,不能活动,需休息后好转。自服消炎药及退热药,未见好转,且心悸加重。既往体健。体格检查:T37.8℃,R20次/分,P115次/分,不规则,Bp105/70mmHg,咽充血,扁桃体不
行业风险分析不但能够帮助商业银行对行业的整体共性风险有所认识,而且可以由此对行业中的每个企业都有一个准确定位。()
在我国现行税制中,对部分税种实行起征点、免征额的减免优惠制度,下列税种中,规定了起征点的有( )。
华兴是一国有大型企业集团公司,为加强内部控制制度建设,聘请天诚会计师事务所对公司的华英、华宝、华建和华鑫4家全资子公司内部控制制度的健全性和有效性进行检查和评价。检查中发现以下问题:(1)华英公司对外违规投资遭遇欺诈,蒙受重大损失6经查,该项投资发生于2
新凯恩斯主义学派在坚持凯恩斯主义思想的基础上,接受了一些新古典学派的观点,该学派认为当劳动供给大于需求时()
劳动对象
设总体X~N(0,σ2)(σ2已知),X1,…,X是取自总体X的简单随机样本,S2为样本方差,则下列正确的是()
下列关于无线局域网设备的描述中,错误的是()。
控制器的功能是( )。
最新回复
(
0
)