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

What does this CRTP-based static polymorphism call resolve to, and is there any virtual dispatch involved?

template <class D> struct Shape { double area() const { return static_cast<const D*>(this)->area_impl(); } }; struct Square : Shape<Square> { double side = 2.0; double area_impl() const { return side * side; } }; Square s; std::cout << s.area();