CJCoding With Joseph
15free / daySign inCreate account
← Back to Question List

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics:
C++ Quiz #112

class or typename in the Template Prefix

easyTemplates

This template is written with class T instead of typename T, and it is called with an int and then a char. What happens?

📄 Code

1#include <iostream>
2 
3template <class T>
4void printTwice(T value) {
5 std::cout << value << " " << value << "\n";
6}
7 
8int main() {
9 printTwice(4);
10 printTwice('a');
11 return 0;
12}