O'Reilly logo

Beginning C++ Through Game Programming, Third Edition by Michael Dawson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. 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:

  • 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

Introducing Inheritance

One of the key elements of OOP is inheritance, which allows you to derive a new class from an existing one. When ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required