摘要: C++语言: Codee#2573601 /*02 构造函数设为私有03 +04 类自身的静态数据成员放到类的内部05 */06 07 #include <iostream>08 using namespace std;09 class Egg10 {11 static Egg e; // it's so strange!12 int i;13 Egg(int ii)14 : i(ii)15 {}16 Egg(const Egg&);17 public:18 static Egg* instance()19 {20 return... 阅读全文
posted @ 2012-03-06 15:32 strorehouse 阅读(144) 评论(0) 推荐(0) 编辑
摘要: C++语言: Codee#2573401 /*02 枚举值不占用对象空间,编译期间得到枚举值03 */04 05 #include <iostream>06 using namespace std;07 08 class Bunch09 {10 enum11 {12 size = 100013 };14 int i[size];15 };16 17 int main()18 {19 cout << "sizeof(bunch) =" << sizeof(Bunch)20 << ",sizeof(i[1000]) = 阅读全文
posted @ 2012-03-06 10:54 strorehouse 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-03-06 10:00 strorehouse 阅读(95) 评论(0) 推荐(0) 编辑