一、

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的装饰者模式

 

版权声明:本文为shamgod原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/shamgod/p/5257719.html