例如
function Person(name){
this.name = name;
}
Person.prototype.shown = function(){ alter(this.name) };
function Student(name){
this.name = name;
}
Student.prototype = new Person();
Student.prototype = Person.prototype;
我想知道为什么没看见有人写下面的继承方式,是有什么弊端吗 ?本人小白
本文讨论了一种使用JavaScript实现对象继承的方法。通过构造函数Person和Student的例子,提出了一个不常见的继承实现方式,并询问这种方式存在的潜在问题。
435

被折叠的 条评论
为什么被折叠?



