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

In this CRTP setup, why must the base call be cast to the derived type, and when is Derived's name usable?

template <class Derived> struct Shape { void draw() { static_cast<Derived*>(this)->draw_impl(); } }; struct Circle : Shape<Circle> { void draw_impl() { /* ... */ } };