看到有好多方法實現繼承,什么組合式繼承、寄生式繼承,有的還有好多缺點,感覺下面這樣或者es6都能很好實現繼承啊,為什么還會有以上那些方法function Parent(name) {
this.name = name}
Parent.prototype.getName = function() {
console.log(this.name)
}function Child(name) {
Parent.call(this, name)
this.*** = ***
///
}
Child.prototype = Object.create(Parent.prototype)
child.prototype.fn = function***
///
為什么會有多種繼承實現方式啊
達令說
2018-07-12 10:16:37