Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++multiple and virtual inheritance layoutSingle-choice MCQ

Given the layout below, what is the most likely relationship between the addresses of the B1 and B2 subobjects of a D object, and why?

struct B1 { virtual void f(); int a; }; struct B2 { virtual void g(); int b; }; struct D : B1, B2 { int c; }; // addresses of B1 vs B2 subobject inside a D?