Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++CRTPSingle-choice MCQ

Within Base's member function body in a CRTP design, why must calls like static_cast<D*>(this)->value() typically appear inside a member function body rather than, say, directly in the class body as a default member initializer?

template <class D> struct Base { // why is D considered complete here but not at the point of declaration? int interface() { return static_cast<D*>(this)->value(); } };