首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #inc1ude <iostream> using namespace std; c1ass Point{ public: static int number, public: Pointo {number++;} ~Point(
有如下程序: #inc1ude <iostream> using namespace std; c1ass Point{ public: static int number, public: Pointo {number++;} ~Point(
admin
2017-06-18
75
问题
有如下程序:
#inc1ude <iostream>
using namespace std;
c1ass Point{
public:
static int number,
public:
Pointo {number++;}
~Point(){number——;)
};
int Point::number——0;
void main0{
Point *ptr;
Point A, B;
{
Point* ptr_point new Point[3];
ptx=ptr_point,
}
Point C;
Gout+Point::number+end1,
delete[] ptr;
}
运行时输出的结果是( )。
选项
A、3
B、4
C、6
D、7
答案
C
解析
此题是静态成员、对象的构造和对象的生存期等知识点的综合考查。此题定义了一个静态成员变量number,初始值为0。主函数中第2行定义了2个Point对象,此时number变为2:随后new运算符又定义了一个包含3个Point对象元素的数组,其通过delete结束后number的值变为5;然后又定义了一个Point对象C,number变为6;最后输出number的内容。
转载请注明原文地址:https://kaotiyun.com/show/AhAp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
执行下列程序的输出结果是______:#include<iostream>usingnamespacestd;classTestClass1{public:voidfun1(){cout<<"Te
下面的程序输出的结果是( )。 #include <iostream> using namespace std; void main(){ int a=2; int &c=a; a++;
在关系数据库中,把数据表示成二维表,每一个二维表称为______。
下列程序中的重载函数disp()发生错误,错误原因是【 】。#include<iostream,h>classSample{priva
有下列二叉树,对此二叉树前序遍历的结果为( )。
在软件生存周期中,能准确地确定软件系统必须做什么和必须具备哪些功能的阶段是
用链表表示线性表的优点是
排序是计算机程序设计中的一种重要操作,常见的排序方法有插入排序、______和选择排序。
在结构化分析方法中,用于描述系统中所用到的全部数据和文件的文档称为______。
随机试题
使用一次后即失去效能的消耗性物品是()
有关不协调性宫缩乏力,不正确的是()
下列税率中,不属于企业所得税税率的是()。
浙江浙海服装进出口公司(3313910194)在对口合同项下进口蓝湿牛皮(法定计量单位:千克),由浙江嘉宁皮革有限公司(3313920237)加工成牛皮沙发革。承运船舶在帕腊纳瓜港装货启运,泊停釜山港转“HANSASTAVANGER”号轮(航次号HV30
()情况下,借款人的营运能力较好。
______是指借款企业由于财务状况恶化或其他原因而出现的还款困难,银行在充分评价贷款风险并与贷款企业协商的基础上,修改或重新制定贷款偿还方案,调整贷款合同条款,控制和化解贷款风险的行为。
大众旅游时期的导游服务主要呈现()特征。
Emergingfromthe1980censusisthepictureofanationdevelopingmoreandmoreregionalcompetition,aspopulationgrowthin
Everyoneknowsthattoomuchtimeinthesuncanexposeyoutoexcessiveultravioletradiation,whichcanleadtoskincancers.【
TheancientreputationofVikingsasbloodthirstyraidersoncoldnorthernseashasundergonearadicalchangeinrecentdecades
最新回复
(
0
)