Skip to content

Instantly share code, notes, and snippets.

@stantona
Created December 3, 2012 20:15
Show Gist options
  • Select an option

  • Save stantona/4197676 to your computer and use it in GitHub Desktop.

Select an option

Save stantona/4197676 to your computer and use it in GitHub Desktop.
Coffeescript inheritance.
__extends = function(child, parent) {
__hasProp = {}.hasOwnProperty
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;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment