Last active
September 23, 2016 19:33
-
-
Save Rhoxio/d525e37878194e02b51958201faec14a to your computer and use it in GitHub Desktop.
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
// Let's build a model that inherits from Animal. | |
var Animal = function(){ | |
this.environment = 'none' | |
this.species = 'none' | |
this.name = 'none' | |
this.hunger = 5 | |
this.consume = function(food){ | |
if(food){ | |
this.hunger -= 1 | |
} | |
} | |
} | |
// We are going to create a Dog class that inherits from Animal. | |
function Dog(){ | |
} | |
// Solidify the Concept and Build Your Own: | |
// Create a set of code that takes a base Vehicle class and uses inheritance to model different types of vehicles. (Car, Truck, Bus, etc.) | |
// Think of attributes common to both the parent and child objects. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment