有人告诉我,由于 C++11 的变化,以下是可能的:
class SomeType {
int number;
public:
SomeType(int new_number) : number(new_number) {}
SomeType() : SomeType(42) {}
};
但是当我尝试构建时出现错误:
"SomeType" is not a nonstatic data member or base class of class "SomeType"
error C2614: 'SomeType' : illegal member initialization: 'SomeType' is not a base or member
Visual Studio 2010 尚不支持此功能吗?我需要配置一些东西来构建它吗?怎么了?