extends

2017-10-31  本文已影响8人  基本密码宋
class Chef {


    constructor(food) {
        this.food = food;
        this.data;
    }

    cook() {
        console.log('我在做饭' + this.food);
    }

    set menu(data) {   //set方法
        this.data = data;
    }

    get menu() {     //get方法
        return this.data;
    }

    static show() {
        console.log("show")
    }


}


class ChefMySelf extends Chef {

    constructor(food) {
        super(food)
    }

}

let chefMySelf = new ChefMySelf('米饭');
chefMySelf.cook()








上一篇 下一篇

猜你喜欢

热点阅读