错误expected identifier before numeric constant

刷题时报错:expected identifier before numeric constant

错误expected identifier before numeric constant_第1张图片

原因:C++类体里,方法以外的区域不允许有初始化;类的数据成员在定义时不能初始化,否则就违背了面向对象抽象的特点

你可能感兴趣的:(错误总结)