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

A base class B has a virtual function f(); a derived D overrides it but changes the return type covariantly from B* to D*. When called through a B*, how does the Itanium ABI usually make the returned pointer correct without the caller knowing about D?

struct B { virtual B* f(); }; struct D : Base2, B { D* f() override; }; // multiple inheritance, B not first base