Skip to content

Latest commit

 

History

History
 
 

01_inheritance

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Inheritance

  • when you have a child class that gets basic behavior from parent class
  • used to avoid rewriting common functions in every class that share similar behavior

In this example, we have two types on enemies (Ninja and Zombie). Since all enemies share certain behaviors (moving left and right) we can write all of the common functionality inside one parent class instead of every enemy class.