es6继承

class father{
constructor(x,y){
this.x=x;
this.y=y;
}
ddd(){}
}
class son extends father{
constructor(x,y,z){
super(x,y);
this.z=z;
}
ggg(){}
}
var r=new son(1,2,3);
console.log(r.__proto__===son.prototype);
console.log(r.__proto__);
console.log(son.prototype);
console.log(father.prototype);
console.log(r instanceof son);
console.log( r instanceof father);
console.log( r.__proto__===son.prototype);//true
console.log(son.__proto__===father);//true
console.log(son.__proto__);//father 类
console.log(son.prototype);//class子类对象

可见 r.__proto__===son;

son.protopype==father;

son.__proto__=class son extends father{....}

posted on 2018-10-30 17:02  偏灬爱  阅读(95)  评论(0编辑  收藏  举报

导航