Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++vtable and vptr layoutSingle-choice MCQ

In a virtual-inheritance diamond, the construction order and vptr management are subtle. During the constructor of base class A (before D's constructor body runs), what does a call to a virtual function resolve to, and why is this enforceable at all given the shared vptr?

struct V { virtual void who(); }; struct A : virtual V { A(); }; struct B : virtual V { }; struct D : A, B { void who() override; }; // D d; -> during A::A(), a virtual call to who() runs