混合继承:
// 构造函数
// 原型对象
// 常用的继承方式之一:
function Parent(n){
this.num = n;
}
Parent.prototype.init = function(){
console.log("hello")
}
function Child(n){
Parent.call(this,n)
}
for(var i in Parent.prototype){
Child.prototype[i] = Parent.prototype[i];
}
Child.prototype.init = function(){
console.log("html")
}
var p = new Parent(3.1415);
p.init()
console.log(p.num)
var c = new Child(520);
c.init()
console.log(c.num)