class Color{
constructor(name){
this.name=name;
}
};
class Shape{
constructor(name,color){
this.name=name;
this.color=color;
}
draw(){
console.log(this.name+this.color.name);
}
}
const red=new Color('red');
const yellow=new Color('yellow');
const circle=new Shape('circle',red);
circle.draw();
桥接模式--其它设计模式
猜你喜欢
转载自blog.csdn.net/aliven1/article/details/104031485
今日推荐
周排行