首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Box{ public: double GetLength() { return length; } double GetWidth();
有如下类定义: class Box{ public: double GetLength() { return length; } double GetWidth();
admin
2021-07-02
29
问题
有如下类定义:
class Box{
public:
double GetLength() { return length; }
double GetWidth();
double GetHeight();
private:
double length,width,height;
};
inline double Box::GetWidth() { return width; }
double Box::GetHeight() { return height; }
在成员函数GetLenth、GetWidth和GetHeight中,内联函数有
选项
A、3个
B、2个
C、1个
D、0个
答案
B
解析
在类体中定义的成员函数,C++系统会自动将它们作为内联函数处理,而在类外定义的成员函数,系统并不把它们默认为内联函数,使用inline也是内联函数,所以共有2个内联函数GetLength和GetWidth,B选项正确。
转载请注明原文地址:https://kaotiyun.com/show/sefp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有如下程序:#includeusingnamespacestd;classTestClass{intn:public:TestClass(intk):n(k){}in
有如下程序:#includeusingnamespacestd;classA{public:virtualvoidfunc1(){cout
如果有以下定义及初始化:inta=3,*p=&a;则由此可以推断,*p的值是()。
关于类定义,下列叙述中错误的是
有如下程序:#includeusingnamespacestd;voidfun(charc){cout
有如下类定义:classPoint{public:voidSetX(intxx){x=xx;}protected:voidSetY(intyy)
ClassA是一个类,且有如下语句序列ClassAc1,*c2;ClassA*c3=newMyClass;ClassA&c4=c1;则ClassA的构造函数被调用的次数是
下面不属于软件设计阶段任务的是
以下程序的执行结果是()。#include<iostream.h>#include<iomanip.h>voidfun(intn){if(n!=0){fun(n-1);
随机试题
行政许可申请人隐瞒有关情况或者提供虚假材料申请行政许可的,行政机关不予受理或者不予行政许可,并给予警告;行政许可申请属于直接关系公共安全、人身健康、生命财产安全事项的,申请人在()内不得再次申请该行政许可。
软件过程是制作软件产品的一组活动及其结果。这些活动主要由软件人员来完成,软件活动主要包括软件描述、____①____、软件有效性验证和___②_____。其中,____③____定义了软件功能以及使用的限制。②
能反映类风湿关节炎病情活动性的实验室指标是
明代对药学发展贡献最大的本草著作是
建筑企业施工期间将其塔吊租赁给同一现场其他企业的收入应计入()。
有持有期为2天、置信号水平为98%的情况下,若所计算的风险价值为2万元,则表明该银行的资产组合()。
下列属于经济费用效益分析指标的有()。
现代学生观承认儿童是独立的人,尊重儿童的人格和权利。确立了()。
下列关于字段属性的叙述中,正确的是()。
A、Addsomepartstoherreport.B、Improveherwriting.C、Getherreportpublished.D、Rewriteherreport.B男士说如果女士想要发表报告的话,得修改其中几
最新回复
(
0
)