CPP > Templates > Beginner Next/Skip this question

What would be the output of the following C++ program using templates?

// virtual members
#include <iostream>

using namespace std;

template <class T>
class A
        T var;

int main () {
    A<int> a;
    a.var = 10;
    A<string> a1;
    a1.var = "hello";
    cout<< a.var << a1.var;
    return 0;
Answers :
social share share on facebook share on twitter share on google plus share on linkedin
Add Comments :



Next Question