es6学习笔记

class Point {
    constructor(x, y) {
        this.x = x;
        this.y = y;
    }
    static classMethod() {
        console.log('fathor jt:hello');
    }
}
class ColorPoint extends Point { //mix(Cons1,Cons2)
    constructor(x, y, color) {
        super(x, y);
        this.color = color; // 正确
    }
    //原型方法
    ptMethod(){
        console.log('pt:hello');
    }
    static classMethod() {
        //静态方法也是可以从super对象上调用
        super.classMethod();
        console.log('jt:hello');
    }
    get prop() {
        return 'getter';
    }
    set prop(value) {
        console.log('setter: '+value);
    }
}

posted on 2016-12-15 13:07  飞旋的留恋-ing  阅读(96)  评论(0)    收藏  举报

导航