继承

function Mother(age){
this.age=age;
this.num=["hello","world"];
}
Mother.prototype.printage=function(){
console.log(this.age);
}

function Person(name,age){

Mother.call(this,age);
this.name=name;

}

Person.prototype=new Mother();
Person.prototype.constructor=Person;

Person.prototype.printname=function(){
console.log(this.name);
}

var p1=new Person("jack",20);
p1;

上面的理解下 继承

分为组合继承 分为
1 组合继承
2 寄生组合继承

寄生组合继承理解有点问题

posted on 2016-05-11 23:00  liuestc  阅读(77)  评论(0编辑  收藏  举报