首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include #include using namespace std; class Wheel{ public: Wheel(string s=
有如下程序: #include #include using namespace std; class Wheel{ public: Wheel(string s=
admin
2015-07-22
19
问题
有如下程序:
#include
#include
using namespace std;
class Wheel{
public:
Wheel(string s="W"):name(s) { cout<
private:
string name;
};
class Bicycle{
public:
Bicycle(string br="G",string r="R"):brand(br),rear(r) { cout<
private:
Wheel front,rear;
string brand;
};
int main(){
Bicycle bike;
return 0;
}
运行时的输出结果是
选项
A、G
B、RG
C、WRG
D、RWG
答案
C
解析
定义Bicycle bike时,执行Wheel的构造函数输出W,然后执行Bicycle的构造函数输出RG,最终输出WRG,选项C正确。
转载请注明原文地址:https://kaotiyun.com/show/xVNp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
在软件设计中,不属于过程设计工具的是
虚函数必须是类的【】。
面向对象程序设计将数据和什么放在一起,作为一个相互依存、不可分割的整体来处理?
下列程序的输出结果为#include<iostream.h>intfunc(intn){if(n<1)returnl;elsereturnn+func(n-1);
应用数据库的主要目的是
有以下程序#include<iostream>usingnamespacestd;classMyClass{public:MyClass();~MyCla
类ostream的成员函数______用于执行无格式输出,成员函数______用于输出单个字符。
类模板的使用实际上是将类模板实例化成一个具体的()。
在结构化分析使用的数据流图(DFD)中,利用【】对其中的图形元素进行确切解释。
如下程序声明了一个使用两个通用数据类型的模板类dataClass,其中构造函数用于初始化两个数据成员,成员函数show用于输出两个数据成员的数值。#include<iostream>usingnamespacestd;【
随机试题
近代最早高度评价和极力提倡小说创作的人是()
下列有关假小叶的描述中,哪项错误()(1998年)
重度哮喘的处理不包括
属于非麻醉性镇痛药的是()。
能将集权与分权实行最优结合且利于解决复杂难题,是()监理组织形式的优点。
渠道管理包括选择和激励中间商,并对他们的推销活动进行评估。()
下列哪种球类运动的场地面积最大?
1英镑的含金量为113.006,1美元的含金量为23.22,黄金的运输费用为0.025美元,求:黄金输入点。
What’syourearliestchildhoodmemory?Canyourememberlearningtowalk?Ortalk?Thefirsttimeyou【C1】______thunderor
Ofallthegoalsoftheeducationreformmovement,noneismoredifficultthandevelopinganobjectivemethodtoassessteachers
最新回复
(
0
)