Created
January 8, 2012 18:11
-
-
Save glesica/1579166 to your computer and use it in GitHub Desktop.
javascript inheritance question
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
// base class | |
function Animal() { | |
// constructor | |
} | |
Animal.prototype.makeNoise = function() { | |
// make noise | |
} | |
// first sub-class | |
function Dog() { | |
// constructor | |
} | |
Dog.prototype = Animal.prototype; | |
Dog.prototype.makeNoise = function() { | |
bark(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment