玩笑过后

导航

继承方法-->一级一级继承

Grand.prototype.lastName = 'ji';
function Grand(){};
var grand = new Grand();
Father.prototype = grand;
function Father(){
      this.name = 'hehe';
};
var father = new Father(); Son.prototype = father;
function Son(){ this.name = 'klkx'
}; var son = new Son(); console.log(son);

缺点没有必要的属性也一并继承了

posted on 2018-06-27 15:50  玩笑过后  阅读(107)  评论(0编辑  收藏  举报