Skip to content

Instantly share code, notes, and snippets.

@Sljubura
Created March 2, 2013 12:39
Show Gist options
  • Save Sljubura/5070829 to your computer and use it in GitHub Desktop.
Save Sljubura/5070829 to your computer and use it in GitHub Desktop.
Proxy inheritance
// Inheritance using proxy
function inherit(Child, Parent) {
var Proxy = function () {};
Proxy.prototype = Parent.prototype; // Set Proxy
Child.prototype = new Proxy(); // Inherit from Parent via Proxy
Child.superclas = Parent.prototype; // Allow access to Parent
Child.prototype.constructor = Child; // Set Child constructor to not point to Parent constructor
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment