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 and Bob classes
- Add Thomas and Bob to the game project
Inheritance ...
Get Beginning C++ Game Programming - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.