HeadFirst设计模式之装饰者模式

一、

1.The Decorator Pattern attaches additional responsibilities to an object dynamically.Decorators provide a fl exible alternative to subclassing for extending functionality.

2.if we rely on inheritance, then our behavior can only be determined statically at

compile time. In other words, we get only whatever behavior the superclass gives us or that we
override. With composition, we can mix and match decorators any way we like... at runtime.

二、

三、JavaIO的装饰者模式

原文地址:https://www.cnblogs.com/shamgod/p/5257719.html