expected identifier before numeric constant错误

我其实不愿意记录报错信息的,但是这种“提示信息无卵用”的我忍不了,于是记录一下。

c++的类体中,方法以外的区域不允许有初始化,简单类型是可以的,但是有构造函数的复杂对象则不行了,比如string对象!

class A{

    vector<string> v(9);  //error,expected identifier before numeric constant

public:
void test(){}
};

原文地址:https://www.cnblogs.com/encode/p/5479058.html