// 寄生组合式继承:原型式继承 + 借用构造函数继承function A() {this.private = '私有属性'}A.prototype.public = '公有属性'// 原型式继承 把父类公有 继承为子类实例的公用B.prototype = Object.create(A.prototype)B.prototype.constructor = Bconsole.log(B.prototype.__proto__ === A.prototype) // truefunction B() {// 借用构造函数继承 把父类的私有属性 继承为子类实例的私有属性this.name = 'b的私有'A.call(this)}let b = new B() // {name: "b的私有", private: "私有属性"}console.log(b.private) // 继承过来的私有属性console.log(b.public) // 继承过来的公有属性// react ES6类的
