Skip to content

Instantly share code, notes, and snippets.

@Sljubura
Created March 1, 2013 12:31
Show Gist options
  • Save Sljubura/5064339 to your computer and use it in GitHub Desktop.
Save Sljubura/5064339 to your computer and use it in GitHub Desktop.
Multiple inheritance
// 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