1 Assume A is a name of a class, how many objects of A has been created by the following sentences:
A * arr[4] = { new A(), NULL,new A() };
解析:注意这个数组里面放的都是指针,所以这个数组与构造没有关系。
注意分辨 A 的数组和A的指针的数组
所以只有两个 new A() 真的构造了A的对象。
1 Assume A is a name of a class, how many objects of A has been created by the following sentences:
A * arr[4] = { new A(), NULL,new A() };
解析:注意这个数组里面放的都是指针,所以这个数组与构造没有关系。
注意分辨 A 的数组和A的指针的数组
所以只有两个 new A() 真的构造了A的对象。