What will happen when you attempt to compile and run the following code? Choose all possible answers.
#include <iostream>
using namespace std;
class B {};
template <typename T>
class A {
T_v;
public:
A() {}
A(T v): _v(v){}
T getV() { return _v; }
void add(T a) { _v+=a; }
};
int main()
{
A<int> a(1);
A<B>b;
a.add(10);
cout << a.getV() <<endl;
return 0;
}
Comments