
C++ 设计模式
文章平均质量分 87
WalleFu
希望做一个思想自由的人, 通过自己的努力给家人提供一个舒适的生活条件,并有能力帮助和影响周围的朋友。
展开
-
C++实现设计模式: An extensible Factory Pattern example
I have read the book Api Design For C++, and I must say it is a masterpiece.There is a section to introduce the Factory Pattern, I think it is the best practical example for this pattern which I hav原创 2013-08-14 12:04:09 · 1079 阅读 · 0 评论 -
C++实现设计模式:Decorator Pattern
注:为了更清楚的解释,类的成员函数均采用inline。#ifndef _COMPONENT_H#define _COMPONENT_H#include using std::cout;using std::endl;class virtualComponent{public: virtual ~virtualComponen原创 2013-08-25 09:56:11 · 822 阅读 · 0 评论 -
C++实现设计模式:Observer Pattern
This example demonstrates creating three separate observer classes and subscribes them for different combinations of the two messages defined by the MySubject class. Finally, the calls to subject.原创 2013-08-25 12:37:10 · 972 阅读 · 0 评论 -
C++实现设计模式: Singleton 单例模式
又一次仔细读了刘未鹏写的《暗时间》,总结自己之所以在编程方面成长不理想的原因就是自己花在总结上的时间太少了,总是写过的代码和用过的模式很快就忘记了,有点过分依赖参考资料和Google.因此,今天起陆续总结一下自己使用过的一些设计模式,不过由于C++设计模式方面的资料很少,我将坚持采用C++语言说明。第一回:Singleton 很简单,不做说明了,有疑问请邮件联系原创 2013-04-17 09:44:44 · 1732 阅读 · 8 评论 -
C++实现设计模式: PIMPL IDIOM
I learned this from the book Professional C++. And code this example to deppen the this practical pattern.The whole design is very compact, and very practical. I think that it is very suitable for a原创 2013-08-16 17:21:35 · 1340 阅读 · 0 评论 -
C++实现设计模式:Bridge Pattern
注:为了简要说明,类的成员函数均采用inline。#ifndef _DRIVE_GAME_H_#define _DRIVE_GAME_H_#include "DriveGameImpl.h"#include using std::cout;using std::endl;class DriveGame{public:原创 2013-08-25 09:54:56 · 1030 阅读 · 0 评论 -
C++实现设计模式:Builder Pattern
注:为了更清楚的解释,类的成员函数均采用inline。#ifndef _BUILDER_H#define _BUILDER_H#include "Product.h"#include using std::cout;using std::endl;using std::string;class Product;class原创 2013-08-25 09:55:40 · 998 阅读 · 0 评论 -
C++实现设计模式: Factory 工厂模式
本来打算原创的,但是读到的这篇文章非常好的诠释了我比较常用的工厂模式,因此这一回翻译一篇来自Cale Dunlap的一篇文章,这里先谢谢Cale。原文链接:http://www.codeproject.com/Articles/363338/Factory-Pattern-in-CplusplusDefinition Basically a Factory翻译 2013-05-03 18:29:27 · 2176 阅读 · 1 评论 -
C++实现设计模式(前传) 之 你必须知道的构造函数
(我的英文其实也不是特别好,但是我坚持尽可能读原汁原味的英文资料,其实读英文更加利于你去理解C++技术。我会在每篇博客中顺带着把英文资料中常用的一些简称介绍一下。另外,我的建议是注释一定要使用英文,且使用简单明了的短句)构造函数(Constructor),资料中常用缩写ctor.主要包括:Defaulted Constructors:默认构造函数,Constructor原创 2013-04-17 20:43:59 · 1324 阅读 · 0 评论 -
C++实现设计模式: Factory Pattern
I have read the book Api Design For C++ recently, and I must say that it is a masterpiece.There is a section to introduce the Factory Pattern, I think it is the best practical example for this patte原创 2014-07-11 11:29:14 · 763 阅读 · 0 评论