O'Reilly logo

Sams Teach Yourself C++ in One Hour a Day, Sixth Edition by Bradley Jones, Siddhartha Rao, Jesse Liberty

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 12. Polymorphism

In Lesson 11, “Implementing Inheritance,” you learned how to write virtual functions in derived classes. This is the fundamental building block of polymorphism: the capability to bind specific, derived class objects to base class pointers at runtime.

In this lesson, you will learn

  • What multiple inheritance is and how to use it

  • What virtual inheritance is and when to use it

  • What abstract classes are and when to use them

  • What pure virtual functions are

Problems with Single Inheritance

Suppose that you’ve been working with your animal classes for a while, and you’ve divided the class hierarchy into Bird and Mammal. The Bird class includes the member function Fly(). The Mammal class has been divided into a number of types of Mammal ...

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