class tower {
public:
unsigned int no; // ERROR!
int *levels = new int[no]; // the error disappears when I comment out this line
tower(int init) {no = init;}
};
我在上面显示了类声明,但由于某种原因,它不起作用。显示的错误消息是:非静态数据成员“tower::no”的使用无效。为什么?我真的不确定发生了什么。
任何人都可以帮忙吗?
谢谢!