I want to write a class that manages euclidean vector and that store its initial point using short, int, long or float. I thought to create a template like this:
template<class unit> class EVector
{
private:
unit x;
unit y;
public:
EVector();
setX();
setY();
};
So user creates an EVector choosing the suitable primitive type. But how can I implement the operation between different classes, e.g.
EVector<int> a;
EVector<float> b;
EVector<double> c;
c = a + b;
operator= will copy the coordinates, operator+ adds them.