我可不可以直接操作__proto__呢
来源:3-13 面向对象(二)

qq_朕知道了_1
2019-05-04
就像这样
function Parent3() {
console.log('parent3 instantiation');
this.name = "parent3";
this.clothes = ["上衣", "裤子", "鞋子", "帽子"];
}
Parent2.prototype.say = function () {
console.log('I am ' + this.name);
};
function Child3() {
Parent3.call(this);
this.type = "child3";
}
Child3.prototype.sayType = function () {
console.log('My type is ' + this.type);
};
Child3.prototype.__proto__ = Parent3.prototype;
写回答
1回答
-
快乐动起来呀
2019-05-05
不可以的
022020-02-12
相似问题