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

On a typical Itanium ABI implementation (GCC/Clang on x86-64), consider this multiple-inheritance object. What does the `static_cast<B2*>(d)` conversion actually do at runtime to produce the B2 subobject pointer?

struct B1 { int x; virtual void f(); }; struct B2 { int y; virtual void g(); }; struct D : B1, B2 { int z; }; D* d = new D(); B2* p = static_cast<B2*>(d);