随笔分类 -  设计模式

[创建型模式] Prototype
摘要:Prototype.h//// Prototype.h// Prototype//// Created by Cheney Shen on 11-2-20.// Copyright 2011年 __MyCompanyName__. All rights reserved.//#ifndef _PROTOTYPE_H_#define _PROTOTYPE_H_class Prototype{ public: virtual ~Prototype(); virtual Prototype* Clone() const = 0; protected: Prototype(); private: }; 阅读全文

posted @ 2011-03-10 03:05 Cheney Shen 阅读(173) 评论(0) 推荐(0)

[创建型模式] Singleton
摘要:Singleton.h//// Singleton.h// Singleton//// Created by Cheney Shen on 11-2-20.// Copyright 2011年 __MyCompanyName__. All rights reserved.//#ifndef _SINGLETON_H_#define _SINGLETON_H_#include <iostream>using namespace std;class Singleton{ public: static Singleton* Instance(); protected: Singleton 阅读全文

posted @ 2011-03-10 03:01 Cheney Shen 阅读(157) 评论(0) 推荐(0)

[创建型模式] AbstractFactory
摘要:AbstractFactory.h//// AbstractFactory.h// AbstractFactory//// Created by Cheney Shen on 11-2-20.// Copyright 2011年 __MyCompanyName__. All rights reserved.//#ifndef _ABSTARCTFACTORY_H_#define _ABSTRACTFACOTRY_H_class AbstractProductA;class AbstractProductB;class AbstractFactory{ public: virtual ~Abst 阅读全文

posted @ 2011-03-10 02:55 Cheney Shen 阅读(156) 评论(0) 推荐(0)

[创建型模式] Builder
摘要:Product.h//// Product.h// Builder//// Created by Cheney Shen on 11-2-20.// Copyright 2011年 __MyCompanyName__. All rights reserved.//#ifndef _PRODUCT_H_#define _PRODUCT_H_class Product{ public: Product(); ~Product(); void ProducePart(); protected: private: };class ProductPart{ public: ProductPart(); 阅读全文

posted @ 2011-03-10 02:53 Cheney Shen 阅读(307) 评论(0) 推荐(0)

[创建型模式] Factory
摘要:Factory.h//// Factory.h// Factory//// Created by Cheney Shen on 11-2-20.// Copyright 2011年 __MyCompanyName__. All rights reserved.//#ifndef _FACTORY_H_#define _FACTORY_H_class Product;class Factory{ public: virtual ~Factory(); virtual Product* CreateProduct()=0; protected: Factory(); private: };clas 阅读全文

posted @ 2011-03-10 02:48 Cheney Shen 阅读(220) 评论(0) 推荐(0)

导航