// 继承实现的几种方式
// 1, class
// 2, prototype
// 3, call/apply/bind
// 4, new
// 最佳实践 2 + 3
function Father(name){
this.name = name
}
Father.prototype.say = function(){
console.log(`${this.name}负责努力赚钱养家`)
}
function Child(name){
Father.call(this,name)
this.name = name
}
Child.prototype = Object.create(Father.prototype)
Child.prototype.constructor = Child
Child.prototype.say = function(){
console.log(`${this.name}负责快快长大`)
}
let f = new Father('小头爸爸')
f.say()
let c = new Child('大头儿子')
c.say()