only static const integral data members can be initialized within a class

只要静态常量int 类型成员变量可以在类内部初始化。

 

only static const integral data members can be initialized within a class
1>生成日志保存在“file://e:\test\testexe\testexe\Debug\BuildLog.htm”

 

class CTest
{
public:
 static const short m_y =3;//正确
 //static short  m_z = 3; //错误
 //const short m_z =3;//错误
 static const long m_y1 = 4; //正确
 static const unsigned short m_y2 = 5;//正确
 //static const float m_z = 6;//错误
};

posted on 2020-07-14 08:42  闻缺陷则喜何志丹  阅读(8)  评论(0编辑  收藏  举报  来源