Hi there everybody,
I recently wrote a matrix class (As in, the mathematical tool), which works perfectly for all my matrix needs. I want to write a vector class based on the matrix class, but with a few more bells and whistles specific to vectors.
The problem is, I want to avoid rewriting code for things such as multiplication of vectors, subtraction, scalar multiplication, because these are identical to matrices. I figured I could do this by providing a conversion operator to a Matrix type. This would allow me to write:
VectorA = VectorA * VectorB;
However, when compiling, I recieve the following error:
error C2676: binary '*' : 'Math::Vector3<_Real>' does not define this operator or a conversion to a type acceptable to the predefined operator
Despite providing the following conversion operator inside Vector3:
//_mData is a member of Vector3, of type matrix, and does support binary *
operator Math::Matrix<_Real>()
{
return _mData;
};
What am I doing wrong? Is this sort of thing even possible? And is there a better way to go about this?
Thanks in advance.