ShannoWu

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

2011年8月21日

摘要: 1 #include <iostream> 2 3 class SingleTone 4 { 5 private: 6 int m_iProp; 7 8 public: 9 static SingleTone& GetInstance()10 {11 static SingleTone instance;12 return(instance);13 }14 15 void SetProp(int val)16 {17 m_iProp = val;18 }19 20 int GetProp() const21 {22 return (m_iProp);23 }24 25 pr 阅读全文
posted @ 2011-08-21 10:09 xiangwei 阅读(184) 评论(0) 推荐(0)

2011年7月24日

摘要: 1 #include <iostream> 2 3 class ProcessData 4 { 5 public: 6 ProcessData() 7 { 8 std::cout << "Construction" << std::endl; 9 }10 11 ~ProcessData()12 {13 std::cout << "Destruction" << std::endl;14 }15 };16 17 // case1:18 // result: Construction Destruc 阅读全文
posted @ 2011-07-24 18:03 xiangwei 阅读(213) 评论(0) 推荐(0)

2011年7月8日

摘要: 1. 代码即文档 1 // 在使用嵌套依赖类型(nested depended name)时 2 class CArray 3 { 4 public: 5 typedef int LengthType; 6 }; 7 8 template<typename T>// 此处(声明模板类型参数, template type argument)与使用template<class T>的效果一样 9 class CMatrix10 {11 public:12 // 如果不用typename指明CArray::LengthType是个嵌套依赖类型,则编译器无法确定13 // CA 阅读全文
posted @ 2011-07-08 18:24 xiangwei 阅读(615) 评论(0) 推荐(1)