Classes give you the perfect way to represent game entities that have attributes and behaviors. But game entities are often related. In this chapter, you’ll learn about inheritance and polymorphism, which give you ways to express those connections and can make defining and using classes even simpler and more intuitive. Specifically, you’ll learn to:
Derive one class from another
Use inherited data members and member functions
Override base class member functions
Define virtual functions to enable polymorphism
Declare pure virtual functions to define abstract classes
One of the key elements of OOP is inheritance, which allows you to derive a new class from an existing one. When ...