-6
我写了这个类:如何增加Class数组的大小?在Turbo C++
class Spacewalk {
private:
char mission[50];
char date[50];
char astronaut[50];
char startingAt[50];
char endingAt[50];
public:
void list() {
// lists the values.
}
void addValue(miss, da, astro, start, end) {
// adds value to the private items.
}
};
我创造了这个类的一个阵列,这样的 -
Spacewalk list[1];
比方说,我用了这个阵列的空间,怎么样我会增加这个大小吗?
使用'的std ::矢量 X;'代替'T X [N];',然后就可以'.resize'或'.push_back'。 –
你可以使用'std :: vector'。也许'std :: string'而不是char数组? –
你是指那个吗? https://stackoverflow.com/questions/12032222/how-to-dynamically-increase-the-array-size – pakkk