Point 类的构造函数被调用的次数是?

来源:百度知道 编辑:UC知道 时间:2024/06/16 15:01:30
class Point{
int x_,y_;
public:
Point():x_(0),y_(0){}
Point(int x ,int y = 0):x_(x),y_(y){}
};
若执行语句
Point a(2),b[3],*c[4];
则Point 类的构造函数被调用的次数是?

这个问题已经过去这么久!!!不知楼主当时解决了么,这上面的答案都是错误的呀,实际上应该只调用了4次的,指针那个是没有调用的,具体什么原因指针每调用暂时我还不知道

Point a(2),//调用Point(int x ,int y = 0):x_(x),y_(y){}
b[3],//调用Point():x_(0),y_(0){} 3次
*c[4];//调用Point():x_(0),y_(0){} 4次

//调用Point(int x ,int y = 0):x_(x),y_(y){} 1次
//调用Point():x_(0),y_(0){}7次

8次