// 寄生组合式继承
const inherit = function (sub, sup) {
const proto = Object.create(sup)
sub.prototype = proto
proto.constructor = sub
}
const SuperType = function (...args) {
this.arg3 = args[0]
}
const SubType = function (arg1, arg2, ...args) {
SuperType.call(this, ...args)
this.arg1 = arg1
this.arg2 = arg2
}
inherit(SubType, SuperType)
SubType.prototype.showArgs = function () {
console.log(this.arg1, this.arg2, this.arg3)
}
const a = new SubType(1,2,3)
const b = new SubType(4,5,6)
console.log(b.__proto__ === a.__proto__)
console.log(b.arg3)
console