// 冒充对象继承// 在子类函数体中,生成一个父类的一个实例,// 把父类的这个实例,进行遍历,给子类的实例一份// 把父类的私有和公有 都继承为子类实例的私有属性function A() {this.private = '私有属性'}A.prototype.public = '公有属性'function B() {this.name = 'B的私有'const temp = new A()console.log(temp)for(let k in temp) {// if (temp.hasOwnProperty(k)) {// this[k] = temp[k]// }this[k] = temp[k]}console.log(this)}let b = new B()// 一个父类可以有多个子类// 一个子类不能有多个父类
