< Previous | Contents | Next >
Inheritance and Polymorphism: Blackjack
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:
n Derive one class from another
n Use inherited data members and member functions
n Override base class member functions
n Define virtual functions to enable polymorphism
n Declare pure virtual functions to define abstract classes