![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
qmroom
喜欢运动,热爱生活
展开
-
设计模式简单代码之Flyweight模式
在一雨田的Blog有一篇关于Flyweight模式的文章: http://blog.csdn.net/dylgsy/archive/2006/08/10/1045678.aspx但在编译运行时,问题产生了:出版社和作者显示不了。 一雨田原来的代码:// Flyweight.cpp #pragma warning(disable: 4786)原创 2008-08-27 09:30:00 · 956 阅读 · 0 评论 -
Singleton单件和仿单件的各种做法探讨
#include #include using namespace std;////////////////////////////////////////////////////////////////////////////////class Singleton {public: static Singleton& Instance() { static Singleton转载 2008-10-16 08:46:00 · 667 阅读 · 0 评论 -
工厂方法(Factory Method)之追根究底
简介工厂方法,通常又被称作虚构造函数,给一个ID,就可以产出一个对象。了解设计模式的人都知道这样一份臭名昭著的实现:// ---------------------------------------------------------------------------------// Shape.henum ShapeType { ShapeType_Line, Sha转载 2008-10-16 08:48:00 · 819 阅读 · 0 评论 -
设计模式简单代码之Flyweight模式(二)
设计模式简单代码之Flyweight模式(二)作者:qmroom来源:http://blog.csdn.net/qmroom 在上篇文章“设计模式简单代码之Flyweight模式”中,我们发现以下两个问题:随着使用Flyweight模式的增多,发现需要增加大量的代码,使用不是很方便;第二个问题也是最重要的问题,仔细研读代码,发现代码并没有释放字符串内存空间,大量使用会造原创 2008-10-22 11:04:00 · 880 阅读 · 0 评论