From Jason Turner
Watch on YouTube

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.

Resources

Tags