Summary
This episode explains virtual inheritance in C++, a feature that many programmers misunderstand. Jason demonstrates how virtual inheritance solves the "diamond problem" by ensuring that a shared base class is instantiated only once in an inheritance hierarchy with multiple paths to that base. Through practical examples, he shows how non-virtual inheritance leads to duplicate base class instances and ambiguous member access, while virtual inheritance merges those instances into a single shared object.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[class.mi]66% match -
[class.virtual]60% match -
[facet.ctype.char.virtuals]56% match