首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类和对象的定义: c1ass Constants{ public; static double getPIO {retum 3.1416;) }; Constants constants, 下列各组语句
有如下类和对象的定义: c1ass Constants{ public; static double getPIO {retum 3.1416;) }; Constants constants, 下列各组语句
admin
2020-04-07
44
问题
有如下类和对象的定义:
c1ass Constants{
public;
static double getPIO {retum 3.1416;)
};
Constants constants,
下列各组语句中,能输出3.1416的是( )。
选项
A、cout<<constants—>getPI();和cout<<Constants::gerPI();
B、cout<<constants.getPI();和cout<<Constants.getPI();
C、cout<<constants—>getPI();和cout<<Constants—>getPI();
D、cout<<constants.getPI();和cout<<Constants::getPI();
答案
D
解析
此题考查的是静态成员函数的引用。getPI()是类Constan ts的静态成员函数。引用静态成员函数可以有两种形式:一是通过类名直接进行调用,例如类名::静态成员函数名:另一种是用类的任何对象名进行调用其作用仅是通过对象名间接的指出类名,例如constants.getPI()选项D即是这种调用方式。
转载请注明原文地址:https://jikaoti.com/ti/cLA0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下程序:#include<iostream>Usingnamespacestd;ClassTestClass{private:intX,y;public:TestClass(inti,i
Staff类含有int型数据成员ID,两个Staff对象相等是指它们的ID相同。下面的函数重载了运算符==,它用来判断两个Staff对象是否相等,相等时返回true,否则返回false。请将横线处缺失部分补充完整。boolStaff::Staf
tb此题考查的是对象的定义。对象的定义格式如下:类名对象名(参数表);所以题目中的tb是对象名标识符,而ta被定义成类MA的指针,故空格处应填tb。
在面向对象方法中,允许作用于某个对象上的操作称为【 】。
以下定义:int(*p)[4]中,标识符p是()。
C++语言的基本控制结构为顺序结构、选择结构和【】。
下列对变量的引用中,错误的是()。
下列叙述中正确的是
语句ofstreamf("SALARY.DAT",ios_base::app)的功能是建立流对象f,并试图打开文件SALARY.DAT与f关联,而且
若有char*x[2]={"xyzw","XYZW"};则下面的表述正确的是______。
随机试题
边际技术替代率是指()
简述牙菌斑微生物作为牙周病始动因子的证据。
治疗失眠宜选用的药物是
甲省A市检察院根据当事人的申诉,发现甲省A市中级人民法院作出的生效判决认定事实确实存在错误,则甲省A市检察院的下列做法中正确的有:()
广义的工程项目管理指开发建设项目施工阶段的管理,对房地产开发项目而言,工程项目管理工程通常取广义的理解。()
根据现行财务制度的规定,在承包企业中,对于技术进步较快或使用寿命受工作环境影响较大的施工机械和运输设备,经财政部批准,计提折旧时可以采用的方法有()。
年末,华力公司主管财务会计工作的副总经理王某召集财务部部长李某及相关人员开会,重点研究本年财务决算的相关事宜,同时财务部汇报几项工作,由领导决定。以下是会议期间的部分发言:王某:受金融危机的影响,公司今年的内销及外销均大幅度下滑,亏损已成定局。财务部正在
甲公司因拖欠乙公司货款被乙公司诉至法院,乙公司胜诉后甲公司拒不执行,乙公司向法院申请强制执行。甲公司知晓后将公司财产陆续转移。下列说法不正确的是()。
A、 B、 C、 B
AspectsthatMayFacilitateReadingI.Determiningyour【T1】______【T1】______A.Readingfor【T2】______:【T2】______likeread
最新回复
(
0
)