单选题
有如下程序: #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 Doint=new Point[3]; ptr=ptr_point; } Point C; coat<
A、
3
B、
4
C、
6
D、
7
【正确答案】
C
【答案解析】
解析:本题考查默认构造函数,题目中定义一个对象A、B以及对象数组Point[3],又定义了对象C,共执行6次构造函数,number变为了6,所以本题答案为c。
提交答案
关闭