全部题库 / C++ / 试题详情
单选题 C++
2014-03-22

有如下程序:
#inClude<iostream>    using namespaCe std;    Class Point{
publiC:
statiC int number;
publiC:
Point(  )t.number++;}        ~Point(  ){number--;}
};    ,  int P0int::number=0;
int main(  ){
Point *ptr:
Point A,B;      Point*ptr_point=new Point[3];    ptr=ptr_point;’
}
Point C;
Cout<<Point:::number<<endl;    delete[]ptr;
return 0;    }
执行这个程序的输出结果是(  )。

A.3
B.4
C.6
D.7

参考答案

C

答案解析

本题考查默认构造函数.题目中定义.个对象A、B以及对象数组Point[3],又定义了对象C,共执行6次构造函数,number变为了6,所以本题答案为C。

你可能感兴趣的试题