首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下类定义: class Box{ public: double GetLength() { return length; } double GetWidth();
有如下类定义: class Box{ public: double GetLength() { return length; } double GetWidth();
admin
2015-07-22
22
问题
有如下类定义:
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/8gNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
有以下程序()。#include<iostream.h>intf(intn){if(n==1)returnl;elsereturnf(n-1)+1;
C++语句constchar*constp="hello";,所定义的指针p和它所指的内容都不能被【】。
在位运算中,操作数每左移一位,其结果相当于
C++语言是以哪种语言为基础逐渐发展演变而成的一种程序设计语言
函数swap(arr,n)可完成对arr数组从第1个元素到第n个元素两两交换。在运行调用函数中的语句后,a[0]和a[1]的值分别为【】。a[0]=1;a[1]=2;swap(a,2);
关键字ASC和DESC分别表示【】的含义。
以下哪个不是C++语言中的有效标识符?
设有下列二叉树: 对此二叉树前序遍历的结果为
下列程序在构造函数和析构函数中申请和释放类的数据成员int*a,申请时使用形参b初始化a,请填空。classA{public:A(intb);~A(
随机试题
硼砂是治疗口腔炎中成药冰硼散的主要成分,其分子式为()。
A.肝的疏泄功能B.肝的藏血功能C.两者均有关D.两者均无关
结核病患者膳食中优质蛋白质应占蛋白质总量的比例为
注册会计师可以在期中或期末实施控制测试或实质性程序,当重大错报风险较高时,注册会计师应当考虑在期末或接近期末实施实质性程序,或采用不通知的方式,或在管理层不能预见的时间实施审计程序。( )如果已识别出由于舞弊导致的重大错报风险,注册会计师应当考虑在期
为扩大市场份额,经股东大会批准,甲公司2×16年和2×17年实施了并购和其他有关交易。(1)并购前,甲公司与相关公司之间的关系如下:①A公司从2×13年1月1日起至今一直直接持有B公司30%的股权,同时受托行使其他股东所持有B公司18%股权的表决权。B
保健食品广告中必须说明的有()。
人体长时间剧烈运动时会产生大量酸性物质,血液中可以起到缓冲作用的物质是()。
简述我国宪法关于立法权和法律、法规制定、修改权的规定。
《沉香屑.第一炉香》《倾城之恋》都是中国著名现代小说家()的代表作品。
用SQL语句将STUDENT表中字段“年龄”的值加1,可以使用的命令是
最新回复
(
0
)