首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include<iostream> using namespace std; class Point{ public: static int number; public: Point
有如下程序: #include<iostream> using namespace std; class Point{ public: static int number; public: Point
admin
2020-07-23
86
问题
有如下程序:
#include<iostream>
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<<Point∷number<<end1:
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/thyp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
一个栈的初始状态为空。现将元素1、2、3、4、5、A、B、C、D、E依次入栈,然后再依次出栈,则元素出栈的顺序是( )。
有如下程序:#includeusingnamespacestd;classXA{inta;public:s
下列有关类继承的叙述中,错误的是()。
下列关于模板的表述中,错误的是
在定义一个类模板时,模板形参表是用一对括号括起来的,所采用的括号是
下列关于this指针的叙述中,正确的是
下列选项中,不是C++关键字的是
下列选项可以做C++标识符的是()。
下列特征中不是面向对象方法的主要特征的是()。
下列数据结构中,能用二分法进行查找的是()。
随机试题
Thehumannoseisanunderratedtool.Humansareoftenthoughttobeinsensitivesmellerscomparedwithanimals,butthisislar
肝硬化患者突然出现剧烈腹痛,发热,腹水迅速增加,脾增大,最大可能并发症是
下列容易误诊为肾实性肿瘤的不包括
当异步电动机接入三相对称交流电时,旋转磁场在()中产生。
A、B企业于2012年5月1日签订买卖合同,合同标的为200万元。根据合同规定,B企业于5月10日提交全部货物,A企业验收合格后,于5月20日提交B企业一张出票后1个月付款的银行承兑汇票,汇票金额为200万,出票日期5月20日,承兑人、付款人为银行。6月1
“我们敢说日常所见的人中,十分之九都是他们的教育所决定的”。这一观点出自洛克的——。
下列关于航天器的说法正确的是()。
What’sTom’spurposeofspeakingtoMr.Clinton?
•Readthearticlebelowaboutthestudyincareerchange.•Inmostofthelines34-45thereisoneextraword.Itiseithergr
ASouthKoreancitydesignedforthefuturetakesonalifeofitsownA)Gettingaroundacityisonething—andthenthere’s
最新回复
(
0
)