【发布时间】:2014-02-25 20:24:36
【问题描述】:
关于通过构造函数实例化数组的简单问题。 我有一个指向类 x 的指针数组,我正在尝试通过构造函数将数组成员设置为 nullptr。
这是我的 y.h
#include <array>
#include "x.h"
class y
{
public:
static const size_t number = 20;
y();
private:
std::array<x*, number> arrayList;
};
这是我的 y.cpp
#include "y.h"
#include "x.h"
#include <array>
using namespace std;
y::y()
: arrayList(nullptr)
{
}
【问题讨论】:
标签: c++ arrays constructor instantiation