Chapter 15: Advanced OOP – Inheritance and Polymorphism
In this chapter, we will further extend our knowledge of OOP by looking at the slightly more advanced concepts of inheritance and polymorphism. We will then be able to use this new knowledge to implement the star characters of our game, Thomas and Bob. Here is what we will cover in this chapter:
- Learn how to extend and modify a class using inheritance
- Treat an object of a class as if it is more than one type of class by using polymorphism
- Learn about abstract classes and how designing classes that are never instantiated can actually be useful
- Build an abstract
PlayableCharacter
class - Put inheritance to work with the
Thomas
andBob
classes - Add Thomas and Bob to the game project