在头文件中定义了一个数组
public:
int nTest[]={1,2,3};
编译报错了2个错:
error C2059: syntax error : '{'
error C2334: unexpected token(s) preceding '{'; skipping apparent function body
请问是什么原因?怎么解决?
public:
int nTest[]={1,2,3};
编译报错了2个错:
error C2059: syntax error : '{'
error C2334: unexpected token(s) preceding '{'; skipping apparent function body
请问是什么原因?怎么解决?
public:
int x = 10;这样肯定不行, 同理, 你的
public:
int nTest[]={1,2,3};
当然不能通过编译了你应该把变量的初始化放到构造函数里public: