【发布时间】:2014-10-04 05:35:31
【问题描述】:
struct A
{
int a = 5; //OK
const int b = 5; //OK
static const int c = 5; //OK
static int d = 5; //Error!
}
error: ISO C++ forbids in-class initialization of non-const static member 'A::d'
为什么会这样?有人可以向我解释这背后的原因吗?
【问题讨论】:
-
@EdHeal 真的吗?
标签: c++