![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
设计模式
beilun
这个作者很懒,什么都没留下…
展开
-
设计模式之策略模式
一、策略模式定义 参考Gang of Four's (GOF) Design Patterns书里的定义:Define a family of algorithms, encapsulate each one, and make them interchangeable. [The] Strategy [pattern] lets the algorithm vary independently ...原创 2008-11-04 18:08:48 · 89 阅读 · 0 评论 -
设计模式之观察者模式
一、定义 参考"Gang of Four"所著的设计模式一书对观察者模式的定义:"a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically." 在对象之间定义一对多依...原创 2008-11-07 14:03:42 · 132 阅读 · 0 评论 -
设计模式之装饰者模式
一、功能描述 装饰者模式可以在运行时期动态的扩展一个类对象的功能,向一个类对象而不是类增加额外的功能。装饰者模式可以看做是继承的替代,两者的不同处是:继承是在编译期间增加类(不是对象)的功能,而装饰者模式则是在运行时动态的添加功能到单个对象。 二、实现描述 动态的向一个对象添加功能是由称之为装饰者的类来完成的,在创建这个装饰者的类的过程中,...原创 2009-02-03 11:07:03 · 96 阅读 · 0 评论