C++ Inheritance & Polymorphism: Multiple Inheritance & the Diamond Hierarchy
C++ allows multiple inheritance which means that one class can have more than one base. C++ also has some powerful mechanisms for dealing with edge cases such as the diamond hierarchy. You will start this course by learning the precise syntax which is required to implement multiple inheritance in C++ specifically how it’s important to have both base class access specifiers marked independently. You will then move on to the topic of a diamond inheritance hierarchy in which the grandchild-level derived class has two parents both of which inherit from the common grandparent level base class. Finally you will see how dynamic casts work in the context of an inheritance hierarchy how these are a lot safer than static casts and how they return a null value on failure when used with pointers but they throw an exception on failure when used with references.