Created
March 1, 2013 12:31
-
-
Save Sljubura/5064339 to your computer and use it in GitHub Desktop.
Multiple 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
// Multiple inheritance with rent-a-constructor | |
function Human() { | |
this.starfleet = true; | |
this.enterprize = true; | |
} | |
function Klingon() { | |
this.empire = true; | |
this.warbird = true; | |
} | |
function Worf() { | |
Human.apply(this); | |
Klingon.apply(this); | |
} | |
var lieutenant = new Worf(); | |
console.log(lieutenant); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment