2017年8月31日

摘要: 根据需求的不同 选择不同的策略算法 之前是保存的各种策略类的指针 这里直接使用 function bind 选择对应的算法 代码 // 005.cpp: 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <functional> #include <ios 阅读全文
posted @ 2017-08-31 10:36 itdef 阅读(194) 评论(0) 推荐(0)
摘要: 参考http://blog.csdn.net/calmreason/article/details/51029285 定义一系列相同的算法 根据不同需求选择不同的算法策略 使用 bind function 见 设计模式 策略模式2 c++11 代码 // 004.cpp: 定义控制台应用程序的入口点 阅读全文
posted @ 2017-08-31 10:16 itdef 阅读(143) 评论(0) 推荐(0)
摘要: 参考http://blog.csdn.net/calmreason/article/details/50909321 桥接模式 实现与抽象之间由指针关联 调用sample类 实际是调用sample类保存的实现类的方法 代码: // 003.cpp: 定义控制台应用程序的入口点。 // #includ 阅读全文
posted @ 2017-08-31 10:10 itdef 阅读(202) 评论(0) 推荐(0)
摘要: 参考http://blog.csdn.net/calmreason/article/details/50903729 所有产品继承同一基本类 由工厂保存基类指针 产生各类产品 代码 // 002.cpp: 定义控制台应用程序的入口点。 // #include "stdafx.h" #include 阅读全文
posted @ 2017-08-31 10:04 itdef 阅读(417) 评论(0) 推荐(0)
摘要: 参考 http://blog.csdn.net/calmreason/article/details/50895191 主要是发布者存储订阅者的指针 发布时依次NOTIFY 发送信息 订阅者在订阅时将自己加入到发布者的容器中 使用C++11 的智能指针 需要注意智能指针的 weak shared的转 阅读全文
posted @ 2017-08-31 09:58 itdef 阅读(285) 评论(0) 推荐(0)

导航