Last active
April 23, 2016 06:44
-
-
Save cynx/b503a6df5d7c77bdd2c659e947d11207 to your computer and use it in GitHub Desktop.
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
var inherits = function (ctor, superCtor) { | |
ctor.super_ = superCtor; | |
Object.setPrototypeOf(ctor.prototype, superCtor.prototype); | |
}; | |
function Manager(managerName) { | |
this.managerName = managerName; | |
} | |
Manager.prototype.getManagerName = function () { | |
return this.managerName; | |
} | |
function Team(managerName, teamName) { | |
this.teamName = teamName; | |
Team.super_.apply(this, arguments); | |
} | |
Team.prototype.getTeamDetails = function () { | |
return this.teamName + ' is managed by ' + this.managerName; | |
} | |
inherits(Team, Manager); | |
var obj = new Team('Klopp', 'LiverpoolFC'); | |
console.log(obj.getTeamDetails()); //LiverpoolFC is managed by Klopp | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment