Created
August 22, 2013 15:47
-
-
Save flarnie/6308973 to your computer and use it in GitHub Desktop.
A helper function to get a target class to inherit from another class without side-effecting the parent class prototype.
This file contains hidden or 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
| Function.prototype.inherits = function(parent){ | |
| function Surrogate(){}; | |
| Surrogate.prototype = parent.prototype; | |
| this.prototype = new Surrogate(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment