首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Box{ public: double GetLength() { return length; } double GetWidth();
有如下类定义: class Box{ public: double GetLength() { return length; } double GetWidth();
admin
2019-07-10
24
问题
有如下类定义:
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/MP8p777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有下列二叉树,对此二叉树前序遍历的结果为()。
有如下程序: #include<iostream> using namespace std; class TestClass { int a; public: TestClass(int x){a=x;} v
下列有关内联函数的叙述中,正确的是()。
下面程序运行输出的结果是【】。#include<iostream>usingnamespacestd;intmain(){chara[]="Chinese";a[3]=’\0’;
派生类继承基类的方式有
源程序文档化要求程序应加注释。注释一般分为序言性注释和【】
有如下的运算符重载函数定义:double operator+(int i,int k){return double(i+k);}但定义有错误,对这个错误最准确的描述是( )。
执行下列语句后,变量sum的值是______。intsum=0;for(inti=1;i<=3;i++)for(intj=1;j<=i;j++)sum++;
以下选项中,()是合法的用户标识符。
随机试题
下列哪项不是产生水肿的因素
伪像产生的原因很多,错误的是
营养不良患儿皮下脂肪减少,首先累及的部位是()
驱虫剂的适宜服法是
《水利工程建设安全生产管理规定》规定,()等特种作业人员,必须按照国家有关规定经过专门的安全作业培训,并取得特种作业操作资格证书后,方可上岗作业。
主要用于收集处于某一时点状态上的社会经济现象的基本全貌,为国家制定有关政策提供依据的统计调查方式是()。
下列情形可能发生的是()。
“蜀南四绝”是指蜀南竹海、石海洞乡、焚人悬棺、真武山古庙群。()
【英荷战争】(Anglo—Dutchwars)
Tea-takingisavery【B1】______customandvery【B2】______thing.Locatedin【B3】______London,theRitzhotelisespeciallywellkno
最新回复
(
0
)