//父构造函数
function Father(uname,age){
//this 指向父构造函数实列
this.uname = uname;
this.age = age;
};
Father.prototype.money = function(){
console.log(1000000);
}
//子构造函数
//继承父类方法
son.prototype = new Father;
//修改constructor指向问题,使其指向原来的构造函数;
son.prototype.constructor = Son;
function Son(uname,age,score){
//改变this指向,继承父类属性
Father.call(this,uname,age);
this.score = score;
}
// 属性继承是通过call()调用函数,修改this指向来实现的
//方法继承时通过中间对于父类的实例化赋值给子类原型来实现的
//注意:不能通过直接把父类原型赋值给子类原型来实现,因为这样子父类原型会指向同一个地址,成为了共享,而不是继承
//详解如下图;
