上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页

2011年5月27日

Chain of Responsibility (C++实现)

摘要: // Chain of Responsibility.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;typedef int Topic;class Handler{public: Handler(Handler* h= 0, Topic t=-1):successor(h),topic(t) { }virtual ~Handler(){}virtual void HandleRequest(Topic t)=0;protected: Handler 阅读全文

posted @ 2011-05-27 18:36 IT@民工 阅读(112) 评论(0) 推荐(0) 编辑

Proxy (C++实现)

摘要: // Proxy.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class Subject{public:Subject(){}virtual ~Subject(){}virtual void Request()=0;};class RealSubject:public Subject{public:RealSubject(){cout<<"Construction of RealSubject"<<end 阅读全文

posted @ 2011-05-27 08:32 IT@民工 阅读(172) 评论(0) 推荐(0) 编辑

2011年5月26日

Flyweight (C++实现)

摘要: // Flyweight.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>#include <list>#include <string>using namespace std;typedef string STATE;class Flyweight{public:STATE GetIntrinsicState(){return m_state;}virtual void Operation(STATE& Extrinsic)=0;protected:Flyw 阅读全文

posted @ 2011-05-26 21:55 IT@民工 阅读(205) 评论(0) 推荐(0) 编辑

Facade (C++实现)

摘要: // Facade.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class ServiceClass{public:ServiceClass(){cout<<"Construction of ServiceClas"<<endl;}virtual ~ServiceClass(){}void Operation1(){cout<<"Do Operation1"<< 阅读全文

posted @ 2011-05-26 14:25 IT@民工 阅读(123) 评论(0) 推荐(0) 编辑

2011年5月25日

Decorator (C++实现)

摘要: // Decorator.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class Component{public:Component(){}virtual ~Component(){}virtual void Operation()=0;};class ConcreteComponent :public Component{public:ConcreteComponent(){cout<<"Construction of C 阅读全文

posted @ 2011-05-25 18:18 IT@民工 阅读(181) 评论(0) 推荐(0) 编辑

2011年5月24日

Composite (C++实现)

摘要: // Compisite.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>#include <list>#include <algorithm>using namespace std;class Componet{public:Componet(){}virtual ~Componet(){}virtual void Operation()=0;virtual void Add(Componet *PChild){/* Empty Body*/} virtual vo 阅读全文

posted @ 2011-05-24 22:35 IT@民工 阅读(227) 评论(0) 推荐(0) 编辑

2011年5月23日

Bridge (C++实现)

摘要: // Bridge.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class Implementor{public: Implementor() { } virtual ~ Implementor() { } virtual void OperationImp()=0;};class ConcreteImpleteorA:public Implementor{public: ConcreteImpleteorA() { cout<<&qu 阅读全文

posted @ 2011-05-23 17:08 IT@民工 阅读(231) 评论(0) 推荐(0) 编辑

Adapter (C++实现 )

摘要: // Adapter.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class Target{public :Target(){}virtual ~Target(){}virtual void Request()=0;};class Adaptee{public:Adaptee(){}virtual ~Adaptee(){}void SpecialRequset(){cout<<"SpecialRequset of Adapte 阅读全文

posted @ 2011-05-23 14:00 IT@民工 阅读(147) 评论(0) 推荐(0) 编辑

Singleton (C++实现)

摘要: // Singleton.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class Singleton{public:Singleton(){}virtual ~Singleton(){}static Singleton* GetInstancePtr(){if(NULL==m_pStatic){m_pStatic=new Singleton();}return m_pStatic;}static Singleton GetInstance(){re 阅读全文

posted @ 2011-05-23 10:17 IT@民工 阅读(127) 评论(0) 推荐(0) 编辑

2011年5月22日

Prototype (C++实现)

摘要: // Prototype.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>using namespace std;class Prototype{public:Prototype(){cout<<"Construction of Prototype"<<endl;}virtual ~ Prototype(){cout<<"Destruction of Prototype"<<endl;}virtual P 阅读全文

posted @ 2011-05-22 18:42 IT@民工 阅读(177) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页

导航