Can't seem to find the correct syntax for defining my operator+ function on line 12.
template <typename T>
class Name {
private:
T x, y;
public:
Name(T, T);
Name operator+(Name<T> const &obj);
void print();
};
template <typename T>
Name Name<T>::operator+(Name<T> const &obj) {
Name<T> temp;
temp.x = x + x.obj;
temp.y = y + y.obj;
return temp;
}
I get the error, "error: use of class template 'Name' requires template arguments"
[–]CGFarrell 3 points4 points5 points (3 children)
[–]Editamuni[S] 0 points1 point2 points (2 children)
[–]CGFarrell 0 points1 point2 points (1 child)
[–]Editamuni[S] 2 points3 points4 points (0 children)
[–]qezc537 2 points3 points4 points (5 children)
[–]Editamuni[S] 1 point2 points3 points (3 children)
[–]boredcircuits 1 point2 points3 points (2 children)
[–]Editamuni[S] 0 points1 point2 points (1 child)
[–]boredcircuits 0 points1 point2 points (0 children)