Created
March 2, 2013 12:39
-
-
Save Sljubura/5070829 to your computer and use it in GitHub Desktop.
Proxy inheritance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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