Dependent Name Hunt
What does this print?
#include <iostream>
#include <string_view>
template <typename Type>
struct X {
void bar() { std::cout << Type::identify(); }
static std::string_view identify() { return "X"; }
};
template <typename Type>
struct Y : Type {
void bar() { std::cout << Type::identify(); }
static std::string_view identify() { return "Y"; }
};
class Z {
protected:
void bar() { std::cout << identify(); }
static std::string_view identify() { return "Z"; }
};
int main() { Y<Z>{}.bar(); }
Sign in to answer questions and track your progress
Sign In