标签:http io ar java for sp c on cti
http://aralejs.org/class/docs/competitors.html
http://javascript.crockford.com/prototypal.html
Here is another formulation:
Object.prototype.begetObject = function () {
function F() {}
F.prototype = this;
return new F();
};
newObject = oldObject.begetObject();
2007-04-02
The problem with the object function is that it is global, and globals are clearly problematic. The problem with Object.prototype.begetObject is that it trips up incompetent programs, and it can produce unexpected results when begetObject is overridden.
So I now prefer this formulation:
if (typeof Object.create !== ‘function‘) {
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
}
newObject = Object.create(oldObject);
2008-04-07
标签:http io ar java for sp c on cti
原文地址:http://www.cnblogs.com/danghuijian/p/4009971.html