首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; class Point { public: static int number; public: Point() { number++; } ~Point() { number-
有如下程序: #include using namespace std; class Point { public: static int number; public: Point() { number++; } ~Point() { number-
admin
2021-06-10
10
问题
有如下程序:
#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/hufp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列叙述中正确的是( )。
使用VC6打开考生文件夹下的源程序文件modil.cpp,但该程序运行时有错,请改正程序中的错误,使程序输出的结果为:151注意:错误的语句在∥********error********的下面,修改该语句即可。#i
有如下程序:classBase{public:intdata;};classDerived1:publicBase{};classDerived2:protectedBase{};intmain(){Deriv
有三个关系R、S和T如下:则由关系R和S得到关系T的操作是()。
如下函数模板:templateTsquare(Tx){returnx*x;}其中T是()。
下列有关类继承的表述中,错误的是
下列关于运算符函数的表述中,错误的是
下面是重载为非成员函数的运算符函数原型,其中错误的是
下列叙述中正确的是
随机试题
“人心不同,各如其面”,这句俗语为人格的独特性作了最好的诠释。
全面了解建设用地范围内各种地基的承载能力,对城市建设用地选择和各类工程建设项目的合理布置以及工程建设的经济性,都十分重要。()
如图16-7—1所示,集中力作用下的简支梁模型设计,σ1=σ2时,P2=100kN,则P1为()kN。
建设工程项目进度控制的管理观念方面存在的主要问题包括( )。
乙公司生产B产品,单位产品价格预计为200元,该产品单位产品变动成本为150元,应负担的固定成本总额为600000元,适用的消费税税率为6%。则B产品运用保本点定价法测算的应实现的销售量为()件。
与缴纳碳排放税相比,工业界更愿意参与碳汇交易。不仅在碳汇交易的规则制定上,工业界往往有较大的发言权,而且还可以通过投资或技术创新,减少支出,甚至通过交易盈利。因此在工业界的游说下,碳汇交易经常成为一项商业活动,其降低碳排放的本意往往被大大削弱。欧盟将于20
小明、小亮、小川、小海在网球场进行了几场球赛的较量。比赛结果是:①小明、小亮对阵小川、小海时,双方势均力敌,不相上下。②当小明与小川对调后,小明、小海一方轻而易举地获胜。③当小海腿受伤退出比赛后,小亮一个人同小明、小川两人同时较量,结果却取胜了。假
2013年1—7月份,某市规模以上工业增加值同比增长12.0%,增速比去年同期提高1.4个百分点。1—7月份,全市国有及国有控股企业完成增加值同比下降3.5%;民营企业完成增加值同比增长24.8%;外商控股企业完成增加值同比下降3.1%。三者增加
有黑、白棋子共300枚,按每堆3枚分成100堆,其中只有1枚白子的共27堆,有2枚或3枚黑子的共42堆,有3枚白子的与有3枚黑子的堆数相等,那么全部棋子中,白子共有多少枚?
"BuildingwithArches"RoundArchandVaultAlthoughtheroundarchwasusedbytheancientpeoplesofMesopotamiaseveral
最新回复
(
0
)