2014年6月24日
摘要: 首先展示一个最简单的单例模式例子,代码如下:class NetworkService { public: // 对外提供的唯一方法函数,用于获取唯一的对象指针 static NetworkService* GetInstance() { if(m_pInsta... 阅读全文
posted @ 2014-06-24 11:23 上海—Michael 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 软件领域中的设计模式为开发人员提供了一种使用专家设计经验的有效途径。设计模式中运用了面向对象编程语言的重要特性:封装、继承、多态,真正领悟设计模式的精髓是可能一个漫长的过程,需要大量实践经验的积累。最近看设计模式的书,对于每个模式,用C++写了个小例子,加深一下理解。主要参考《大话设计模式》和《设... 阅读全文
posted @ 2014-06-24 11:06 上海—Michael 阅读(163) 评论(0) 推荐(0) 编辑
摘要: #include #include int main( ){ using namespace std; using namespace stdext; hash_map hm1; hash_map :: const_iterator hm1_AcIter, hm1_RcIter;... 阅读全文
posted @ 2014-06-24 10:16 上海—Michael 阅读(143) 评论(0) 推荐(0) 编辑