The decorator pattern attachs additional responsibilities to an object dynamically.Decorators provide a flexiblealternative to subclassing for extending functionality.

  • 定义:可以动态的给对象增加新的功能。就扩展功能上来讲,它比生成子类更为灵活。
目录 查词历史