Skip to content
Quiz · Templates · lesson 7 of 11

Quiz — which specialization is chosen

What does the program print?

C++
#include <iostream>

template <typename T> struct Tag { char get() { return 'T'; } };
template <> struct Tag<int> { char get() { return 'i'; } };

int main() {
    Tag<int> a;
    Tag<short> b;
    std::cout << a.get() << b.get();
}