首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #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
29
问题
有如下程序:
#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;classBase{private:voidfun1()const{cout<<’’fun1’’;}
在C++中,打开一个文件时与该文件建立联系的是()。
用VC6打开考生文件夹下的源程序文件modi3.cpp,这个程序完成输出到屏幕一些特定的信息,但工程有错误或者不完整,请完成以下功能:(1)初始化mNum2的值为j,请在注释//********1********后添加适当的语句。(2)补充全局函数f
下面不能作为软件设计工具的是
下列关于虚函数的叙述中,正确的是
执行下列语句段后,输出字符“*”的个数是()。for(inti=50;i>1;I-=2)cout
下列符号中,正确的C++标识符是()。
下列符号中不属于C++关键字的是()。
设二叉树的前序序列为ABDEGHCFIJ,中序序列为DBGEHACIFJ。则按层次输出(从上到下,同一层从左到右)的序列为
对序线性表(23,29,34,55,60,70,78)用二分法查找值为60的元素时,需要比较次数为()。
随机试题
诊断小儿肺结核的主要方法是
关于片剂的常规检查,下列说法不正确的是
含有四级结构的是
肿瘤血道播散最常见的部位是()。
经济法的综合性特征体现在()。
应收账款的入账价值包括()。
大气污染防治的基本方法有________。
下列选项中,应当认定为合同法中要约的是()。
A、Hehasprovedtobeabetterreaderthanthewoman.B、Hehasdifficultyunderstandingthebook.C、Hecannotgetaccesstothe
Accordingtoarecentstudy,theideaofagingmightlookdifferentthroughtheeyesoflittlechildren.Agoodnumberofchildr
最新回复
(
0
)