首页 > Web开发 > 详细

js中,类的继承

时间:2017-08-06 23:49:53      阅读:182      评论:0      收藏:0      [点我收藏+]

创建类:
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‘);
    }
}

js中,类的继承

原文:http://www.cnblogs.com/baichuan147258/p/7296370.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!