Skip to content

Instantly share code, notes, and snippets.

@daniellmb daniellmb/classic.js
Last active Dec 14, 2015

Embed
What would you like to do?
Classic "Holy Grail" inheritance pattern using an immediate function to store the proxy.
var inherit = (function () {
var proxy = function () {};
return function (child, parent) {
proxy.prototype = parent.prototype;
child.prototype = new proxy();
child._super = parent.prototype;
child.prototype.constructor = child;
}
}());
//example use
//inherit(Child, Parent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.