设计模式 装饰模式 半透明模式

求助大佬,设计模式立面的装饰模式里面有个半透明装饰模式  我想问下 为什么半透明不能实现二次装饰?
我自己的理解: 因为虽然是具体装饰类的对象,但是具体装饰类传入的是抽象构件类对象,而具体装饰类也是间接继承自抽象构件类的呀,而且我代码也试过了成功的
package DecoratorPattern;

public class MainClient {  public static void main(String[] args) {  Component component=new Window();  ScrollBarDecorator componentDecorator=new ScrollBarDecorator(component);  Component component2=new BlackBorderDecorator(componentDecorator);  component2.display();  }
}

#Java##设计#
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务