Hello I want to multiply a matrix by a number at left, something like : N=a*M where a is a number.
If i wanted to multiply at right i would have simply overloaded the operator * in my matrix class. But what shall I do in this case ? Can I overload the operator * of float even if it's a "default" class ? (I'm not even sure it's a class)
You would have to define the function in terms of the other. For example:
Matrix operator *(float x, Matrix const& m)
{
return m * x;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With