<分区>
Possible Duplicate:
C++ multi dimensional array
我正在尝试创建一个类,该类根据对象构造函数参数之一创建任意大小的字符串数组。
这里是我目前正在尝试的对象构造函数的代码:
commandSpec::commandSpec(int numberOfCommands)
{
std::string * commands = new std::string[3][numberOfCommands];
}
我得到一个错误:“numberOfCommands 不能出现在常量表达式中”,有人可以告诉我在执行之前我不知道大小的对象中指定数组的正确方法。
谢谢你