2
我剛剛讀過好的部分,我對某些東西有些困惑。 pseudoclassical繼承Crockford的例子是這樣的:這個問題的在克羅克福德的古典古典繼承模式中使用`this`
var Mammal = function (name) {
this.name = name;
};
Mammal.prototype.get_name = function() {
return this.name;
};
部分原因是構造函數「其膽量掛出」 - 方法是構造函數之外。儘管如此,我在構造函數裏看不到get_name
到this
有什麼問題。是否因爲我們最終得到了get_name
方法的多個副本?