js中,类的继承

创建类:
class student{
    constructor(name,age){
        this.name=name;
        this.age=age;
    }
    learn(){
        console.log('我是学生');
    }
}
类的继承:
class child extends Student{
    constructor(name,age){
        super (name,age);
    }
    coolings(){
        console.log('cooling');
    }
}

posted on 2017-08-06 22:57  白川  阅读(86)  评论(0编辑  收藏  举报

导航