I have a 3D vector class. I have overloaded operator *= such that it can take a scaler value on the right hand side. That is working fine.
Now I have a second loaded operator* which takes a Vector3D arg AND a scaler arg.
So, it would work thus:
Vector3D scaledVec = oldVec * 3.0;
My question is, how would I make the operation commutative such that the following would also be valid:
Vector 3D scaledVec = 3.0 * oldVec;
Must I overload the function?