首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include<iostream> using namespace std; class XA{ int a; public: static int b; XA(int a A) : a(aA) {
有如下程序: #include<iostream> using namespace std; class XA{ int a; public: static int b; XA(int a A) : a(aA) {
admin
2017-10-17
54
问题
有如下程序:
#include<iostream>
using namespace std;
class XA{
int a;
public:
static int b;
XA(int a
A) : a(aA) {b++;}
~XA(){}
int get(){return a;}
};
int XA::b=0;
int main(){
XA d1(2), d2(3);
cout<<d1. get()+d2. get()+XA::b<<end1;
return 0;
}
运行时的输出结果是( )。A) 5
B) 6
C) 7
D) 8
选项
A、
B、
C、
D、
答案
C
解析
转载请注明原文地址:https://kaotiyun.com/show/eWAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列程序的执行结果为#include<iostream.h>voidmain(){inta=3,b=0;int*p=&a;b=+a++;cout<<*
下列哪个是C++语言的有效标识符?
下列叙述中错误的是
栈通常采用的两种存储结构是()
()既可重载为一元运算符,又可重载为二元运算符。
已知类Sample中的一个成员函数说明如下:voidSet(Sample&a);其中,Sample&a的含意是()。
运算符函数调用格式的表达式y/x++与表达式y.operator/(operator++(x,0))的含义相同,由此可看出()。
在下面程序的横线处填上适当的语句,使该程序的输出为12。#include<iostream>usingnamespacestd;classBase{public:inta;Base(
有如下类声明:classXA{intx;public:XA(intn){x=n;}};classXB:publicXA{
下列程序将x、y和z按从小到大的顺序排列,请将下面的函数模板补充完整。template<classT>voidfun(______){Ta;if(x>y)
随机试题
Wedidn’tknowhistelephonenumber,otherwisewe______him.
A.肾盂B.肾静脉C.肾动脉D.肾乳头E.肾柱肾蒂中位于最上方的结构是
预防过敏性哮喘最好选用
干槽症的特征性表现是
()的基本原理是运用逻辑学的方法,来推断预测对象未来发展趋势。
贷前调查完成后,银行经办人应对调查结果进行整理、分析,提出是否同意贷款的明确意见及()等方面的建议。
在我国文化史上,()都可以表示“第一”。
设二次型f(x1,x2,x3)=x12-x22+2ax1x3+4x2x3,的负惯性指数为1,则a的取值范围是__________.
The______whichinlaterlifehedevelopedtowardsCharlestonsuggeststhathis______childhoodhadleftunsatisfiedhisneedfor
Youshouldspendabout20minutesonQuestions1-13,whicharebasedonReadingPassage1below.TheConnection
最新回复
(
0
)