浏览 2044 次
锁定老帖子 主题:设计模式金玉良言<二>
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-04-10
最后修改:2009-04-20
* Decorators have the same supertype as the objects they decorate.(装饰类和被装饰类具有同样的超类) * you can use one or more decorators to wrap an object.(可以用多个装饰类来包装同一个类) * we can pass around a decorated object in place of the original(wrapped) object.(考虑到装饰类和被装饰类具有同样的超类,我们可以嵌套装饰。??) * the decorator adds its own behavior either before and/or after delegating to the object it decorates to do the rest of the job.(装饰类会调用被装饰类的behavior来完成自己的behavior) * objects can be decorated at any time, so we can decorate objects dynamically at runtime with as many decorators as we like.(可以在任何时候来装饰对象,常用的方法是用构造函数来实现。)
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |