Created
October 24, 2011 11:30
-
-
Save edmore/1308818 to your computer and use it in GitHub Desktop.
Functional 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
var person = function(spec){ | |
var that = {}; | |
that.getName = function(){ | |
return spec.name; | |
}; | |
that.getSex = function(){ | |
return spec.sex; | |
}; | |
return that; | |
}; | |
var developer = function(spec){ | |
var that = person(spec); | |
that.getLanguage = function(){ | |
return spec.language; | |
}; | |
that.getExperience = function(){ | |
return "Years of experience : " + spec.experience; | |
}; | |
return that; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment