今天介绍下策略模式,直接先上UML图 策略模式的概念 The Strategy Pattern defines a family of algorithms,encapsulates each one,and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.–(翻译)– 定义一系列的算法,把它们一个个封装起来, 并且使它们可相互替换.策略模式使得…
// test01.cpp : Defines the entry point for the console application.////第一章,设计模式入门,策略模式#include "stdafx.h"#include "test01.h" class FlyBehavior{public: virtual void fly(){};}; class FlyWithWings:public FlyBehavior{public: void fly()…