ブリッジモード - 他のデザインパターン

クラスカラー{
    コンストラクタ(名前){
        this.name =名。
    }
}。
 クラス形{
    コンストラクタ(名前、色){
        this.name =名。
        this.color =色。
    }
    {)(描画
        はconsole.log(this.name + this.color.name)。
    }

CONST赤=新色( '赤')。
constの黄色=新色( '黄色');
CONST円=(赤い「丸」、)新しい形。
circle.draw();

 

公開された234元の記事 ウォン称賛24 ビュー290 000 +

おすすめ

転載: blog.csdn.net/aliven1/article/details/104031485