设计模式--装饰模式(Decorator)

装饰模式(Decorator) :  动态的给一个对象添加一些额外的职能,就增长功能来讲,装饰模式比生成子类更为灵活。 实例: ConcreteComponent:让Decorator对象为本身添加功能。有时候使用ConcreteComponent的派生类提供核心功能,在这种状况就是用ConcreteComponent替代了Component的功能,并且装饰者是继承于ConcreteCompone
相关文章
相关标签/搜索