2013年10月13日
摘要: 一、类类的静态变量1、在类内进行声明2、在类外进行初始化3、只有const static int类型才能在类内进行初始化错误初始化1:#include class TestClass1{public: static int s;};void main(){ TestClass1::s = 1;//error LNK1120: 1 个无法解析的外部命令;不能在此初始化}错误初始化2(类内的初始化):#include class TestClass1{public: //错误的类内初始化 static int s = 1;//error C2864: “TestClass1... 阅读全文
posted @ 2013-10-13 17:40 奎哥 阅读(401) 评论(0) 推荐(0) 编辑