【发布时间】:2012-11-07 17:22:33
【问题描述】:
我正在尝试在我的类中创建一个静态字符串:(在我的头文件中)
static string description = "foo";
但我收到此错误:
IntelliSense: a member with an in-class initializer must be const
如果我把它改成这样:
static const string description = "foo";
我得到了这个错误:
IntelliSense: a member of type "const std::string" cannot have an in-class initializer
我做错了什么?
【问题讨论】:
-
使用描述变量粘贴代码