我認爲他們是等價的,但我不知道:這兩種繼承策略有什麼區別?
var __extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) child[key] = parent[key];
}
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
而且
var __extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) child[key] = parent[key];
}
child.prototype = parent.prototype;
child.prototype.constructor = child;
child.__super__ = parent.prototype;
return child;
};
而你傳遞兩個函數? – Bergi 2012-08-04 01:36:30