2018年1月6日
摘要: //prototype.cpp //原型模式:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象 #include "gtest/gtest.h" class Prototype { public: Prototype() {} virtual ~Prototype() {} virtual Prototype* Clone() = 0; }; cla... 阅读全文
posted @ 2018-01-06 22:41 生活的艺术 阅读(152) 评论(0) 推荐(0)
摘要: 最近阅读了《大话设计模式》,接下来结合用例总结典型设计模式,并将代码上传到github: https://github.com/BillZPage/PatternCase.git 阅读全文
posted @ 2018-01-06 22:36 生活的艺术 阅读(103) 评论(0) 推荐(0)
摘要: 用例: 阅读全文
posted @ 2018-01-06 22:34 生活的艺术 阅读(151) 评论(0) 推荐(0)
摘要: //factory.cpp //工厂模式 #include #include "gtest/gtest.h" class Operation { public: Operation() : x(0), y(0) {} virtual ~Operation() {} int x; int y; vi... 阅读全文
posted @ 2018-01-06 22:32 生活的艺术 阅读(122) 评论(0) 推荐(0)
摘要: 实例: 阅读全文
posted @ 2018-01-06 22:31 生活的艺术 阅读(124) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2018-01-06 14:49 生活的艺术 阅读(119) 评论(0) 推荐(0)