//原型链继承
// function Pardent(){
// this.name="dxy";
// }
// Pardent.prototype.age=22
// function Child(){
// this.data="11-7"
// }
// Child.prototype=new Pardent()
// var child=new Child()
// console.log(child.data)
//构造继承
// function Pardent(name){
// this.name = name;
// }
// Pardent.prototype.age=22
// function Child(){
// Pardent.call(this,"dxyuuu")
// }
// var child=new Child();
// console.log(child.age)
//组合继承
function Pardent(name){
this.name = name;
}
Pardent.prototype.age=22
function Child(){
Pardent.call(this,"dxyuuu")
}
Child.prototype=new Pardent()
var child=new Child();
console.log(child.name)