原型指向改变如何如何添加方法和访问
function Person(age
) {
this.age
= age
;
}
Person
.prototype
.eat = function () {
console
.log("eat")
}
function Student(sex
) {
this.sex
= sex
}
Student
.prototype
.sayHi = function () {
console
.log("nihao")
}
Student
.prototype
= new Person(10);
转载请注明原文地址: https://win8.8miu.com/read-1455589.html