All challenges
Code AnalysisBeginner 60s

CRTP Static Dispatch Output

What does this print?
Starter code
#include <iostream>
template<class D> struct Base { void call(){ static_cast<D*>(this)->impl(); } };
struct X : Base<X> { void impl(){ std::cout << "X"; } };
int main(){ X x; Base<X>& b = x; b.call(); }

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle