【发布时间】:2015-03-08 16:43:56
【问题描述】:
class Array
{
public:
Array(int = 10); // default constructor
~Array(); // destructor
protected:
int size; // number of elements in the Array
int *ptr; // address of dynamically allocated memory
};
有人可以举例说明默认构造函数 (int = 10) 的含义吗?另外,如何创建一个数组类型的新对象并自动为其赋值。
【问题讨论】:
标签: arrays class constructor operators overloading