Last active
April 23, 2016 06:43
-
-
Save cynx/b1f4f6706c4e2e05c232b81b08055978 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; | |
ctor.prototype = Object.create(superCtor.prototype, { | |
constructor: { | |
value: ctor, | |
enumerable: false, | |
writable: true, | |
configurable: true | |
} | |
}); | |
}; | |
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()); //obj.getTeamDetails is not a function | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment