【发布时间】:2017-12-11 10:07:14
【问题描述】:
我正在尝试初始化相同类对象的指针数组。这是课程:
class Correspondent{
private:
static Correspondent *correspondent[maxCorrespondents];
}
我试过在constructor。但它每次都会被初始化。
Correspondent::Correspondent(string n,string c) {
name = n;
country = c;
for(int i=0;i<=maxCorrespondents;i++){
correspondent[i] = NULL;
}
}
【问题讨论】: