摘要: 图1:图2:Component是定义一个对象接口,可以给这些对象动态地添加职责。ConcreteComponent是定义了一个具体的对象,也可以给这个对象添加一些职责。Decorator,装饰抽象类,继承了Component,从外类来扩展Component类的功能,但对于Component来说,是无需要知道Decorator的存在的。至于ConcreteDecorator就是具体的装饰对象,起到给Component添加职责的功能。View Code public class Text{ //测试端代码 public static void main(String[] args){ ... 阅读全文
posted @ 2012-05-30 15:44 銘魜 阅读(93) 评论(0) 推荐(0) 编辑