首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; class Point{ public: static int number; public: Point();number+
有如下程序: #include using namespace std; class Point{ public: static int number; public: Point();number+
admin
2021-06-10
24
问题
有如下程序:
#include
using namespace std;
class Point{
public:
static int number;
public:
Point();number++;}
~Point(){number--;}
};
int Point::number=0;
int main(){
Point*ptr;
Point A,B;
;
Point*ptr_point=new Point[3];
ptr=ptr_point;
}
Point C:
cout<
delete[]ptr;
return 0;
}
执行这个程序的输出结果是( )。
选项
A、3
B、4
C、6
D、7
答案
C
解析
本题考查默认构造函数,题目中定义一个对象A、B以及对象数组Point[3],又定义了对象C,共执行6次构造函数,number变为了6,所以本题答案为C。
转载请注明原文地址:https://kaotiyun.com/show/Xcfp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列选项中不属于面向对象程序设计特征的是()。
下列叙述中正确的是
软件调试的目的是()。
有如下程序:#include<iostream>usingnamespacestd;classPublication{//出版物类charname[30];Publication(char*nam
有三个关系R、S和T如下:由关系R和S通过运算得到关系T,则所使用的运算为()。
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是()。
有如下程序:#includeusingnamespacestd;classMyClass{public:MyClass(intx):val(x)()voidPrint()const{co
用VC6打开考生文件夹下的源程序文件modi3.cpp,这个程序完成输出到屏幕一些特定的信息,但工程有错误或者不完整,请完成以下功能:(1)初始化m_Num2的值为j,请在注释//********1********后添加适当的语句。(2
一般情况下,当对关系R和S进行自然连接时,要求R和S含有一个或者多个共有的
若字符指针P所指向的字符串为ˊˊabcdefgˊˊ,在执行语句()。char*ap=newchar[strlen(p)+1];之后,ap指向的字符数组的元素个数为
随机试题
Compassionisagreathumanemotion,whichreferstothepityforthosewhosuffer____.
HowtoWriteaSpeechWecancategorizethewholeprocessofwritingaspeechintotwostages.ThepreparatoryperiodFi
皑皑白雪,在晚霞的映照下,呈现出一片红色,但是我们对雪地的知觉仍然是白色。这是因为人的知觉具有
地下室设有大型制冷机房时,制冷机的出入问题,优先考虑下列中的哪种方案?
()分为一级保护野生动物和二级保护野生动物。
发放股票股息的目的是()。
下列不属于幼儿园教学的特点是()。
根据以下资料。回答问题。2011年第四季度我国劳动力市场中各文化程度需求人数中的比例居于第三的是:
LikealotofearlessNewYorkers,Iamgenerallyconfusedbyburstsofpopulistoutrageoverhighgasprices.ButIhavealways
Parentstakeagreatinterestinthe______questionsraisedbytheirchildren.
最新回复
(
0
)