首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; class Point{ public: static int number; public: Point(){number++;} 一Point(){number一一;} }; i
有如下程序: #include using namespace std; class Point{ public: static int number; public: Point(){number++;} 一Point(){number一一;} }; i
admin
2019-06-12
75
问题
有如下程序:
#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/uL8p777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下面程序的输出结果是()。#include#include“string.h”voidmain(){chara[]=“HelloTest”,b[]=“Test”;strcpy
为了取代C中带参数的宏,在C++中使用()。
基类为虚函数,撤销对象调用析构函数时,采用__________联编。
下列叙述中错误的是()。
Jackson方法是一种面向_____________的结构化方法。
下列哪一条不属于数据库设计的任务?()
在软件生产过程中,需求信息的给出是()
关系数据库的概念模型是()的集合。
有下列二叉树,对此二叉树前序遍历的结果为()。
数据库管理系统是
随机试题
若总体服从正态分布,方差已知,检验总体均值是否等于某个值时,使用_____。
由于外部经济环境变化导致的车辆的贬值,称为_______。
头颅摄影特点的叙述,错误的是
以大承气汤治腹痛,其功能是取以柴胡疏肝散治腹痛,其功能是取
患者,女,50岁。头痛昏蒙,胸脘满闷,呕吐痰涎,舌苔白腻,脉弦滑,治疗应首选()
下列属于侵犯人身自由权的行为是()
选择电动卷扬机的额定拉力时,应注意滑轮组跑绳的最大拉力不能大于电动卷扬机额定拉力的()。
简述实践与认识的辩证关系原理及其方法论。
Itwouldbeinterestingtodiscoverhowmanyyoungpeoplegotouniversitywithoutanyclearideaofwhattheyaregoingtodoa
A、MainlyfromLondon.B、MainlyfromEngland.C、Fromdifferentcountries.D、Fromcharityorganizations.C[听力原文]Wheredothepeop
最新回复
(
0
)