Skip to content

Instantly share code, notes, and snippets.

@cobbdb
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cobbdb/395c34963c235c6ef77a to your computer and use it in GitHub Desktop.
Save cobbdb/395c34963c235c6ef77a to your computer and use it in GitHub Desktop.
Notes for dirt simple JS inheritance
function BaseClass(child) {
var key;
child = child || {};
this.base = {};
for (key in this) {
this.base[key] = this[key];
}
for (key in child) {
this[key] = child[key];
}
return this;
}
BaseClass.Abstract = function () {
throw Error('[BaseClass] Abstract method was called without definition.');
};
BaseClass.Stub = function () {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment