What will happen when you attempt to compile and run the following code?
#include
using namespace std;
class C {
public:
int _c;
C():_c(0){}
C(int c) { _c = c;}
C operator+=(C & b) {
C tmp;
tmp._c = _c+b._c;
return tmp;
}
};
template
class A {
T_v;
public:
A() {}
A(T v): _v(v){}
T getV() { return _v; }
void add(T & a) { _v+=a; }
};
int main()
{
A
A
Cc;
a.add(c);
cout << a.getV() < return 0; }
Currently there are no comments in this discussion, be the first to comment!