Skip to content

Instantly share code, notes, and snippets.

@goliatone
Created March 14, 2014 20:34
Show Gist options
  • Save goliatone/9556241 to your computer and use it in GitHub Desktop.
Save goliatone/9556241 to your computer and use it in GitHub Desktop.
var _hasProp = {}.hasOwnProperty,
_inherit = function (child, parent) {
for (var key in parent) {
if (_hasProp.call(parent, key)) child[key] = parent[key];
}
if(typeof child === 'string') child = self;
function ctor() {
this.constructor = child;
}
function self(){parent.apply(this, arguments);};
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child._super = parent.prototype;
child.prototype.__super__ = parent;
return child;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment