设计模式——装饰模式和代理模式

1 装饰模式  装饰模式,动态地给一个对象添加一些额外的职责,就增加功能来说,装饰模式比生成子类更为灵活。装饰模式的结构如图所示。   public interface Component { void operation(); } public interface Decorator extends Component { void addedBehavior(); } public
相关文章
相关标签/搜索