11 2011 档案
策略模式
摘要:策略模式是一种定义一系列算法的方法,从概念上来看,所有这些算法完成的都是相同的工作,只是实现不同,它可以以相同的方式调用算法,减少了各种算法类与使用算法类之间的耦合。// Strategy.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;class IStrategy{public:virtual void algorithmInterface()= 0;};class Str 阅读全文
posted @ 2011-11-24 16:16 Just a Programer 阅读(174) 评论(0) 推荐(0)
抽象工厂模式
摘要:// Factory.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;class IProduct{public:virtual void doSomething() = 0;};class ProductA: public IProduct{public:void doSomething(){std::cout<<"Product A doSomethi 阅读全文
posted @ 2011-11-22 17:01 Just a Programer 阅读(334) 评论(0) 推荐(0)