LogiQuest
Back to Templates
3

What will be the output of the program?

#include <iostream>
using namespace std;
template <typename T>
struct Box { T v; T get() { return v; } };
int main() {
    Box<int> b{5};
    Box<char> c{'z'};
    cout << b.get() << c.get() << endl;
    return 0;
}
Medium

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.