Skip to content

Instantly share code, notes, and snippets.

@Rhoxio
Last active September 23, 2016 19:33
Show Gist options
  • Save Rhoxio/d525e37878194e02b51958201faec14a to your computer and use it in GitHub Desktop.
Save Rhoxio/d525e37878194e02b51958201faec14a to your computer and use it in GitHub Desktop.
// 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