【发布时间】:2016-02-24 14:18:41
【问题描述】:
这两个成员在初始化和实例化问题上到底有什么区别?:
class Test {
// ctor, dtor, ... here
private:
static int m_test = 0; // error - non-const ...
static const int m_const_test = 0; // working - const ...
};
为什么非常量成员的初始化无效? 什么时候会实例化两个变量(假设没有 init 的非 const 成员!)?
编辑:即使这个问题的很大一部分可以叠加到提到的帖子中,我认为这些条目中并没有回答我问题的每个部分。
BR,金枪鱼
【问题讨论】: