Hello everybody,
I use the following definition in a class VecR for vectors:
VecR operator*(const double);
VecR VecR:perator*(const double a)
{
VecR mV(x*a,y*a,z*a);
return (mV);
}
in order to multiply a vector (VecR) and a scalar (double).
Now, say 'A' is a vector and 'fac' is a scalar value.
In the program only 'A * fac' is accepted:
error: no match for 'operator*' in 'fac * A'
Is there a method to create an overloaded operator which
represents both left and right multiplication?
Kind regards
V.K.
I use the following definition in a class VecR for vectors:
VecR operator*(const double);
VecR VecR:perator*(const double a)
{
VecR mV(x*a,y*a,z*a);
return (mV);
}
in order to multiply a vector (VecR) and a scalar (double).
Now, say 'A' is a vector and 'fac' is a scalar value.
In the program only 'A * fac' is accepted:
error: no match for 'operator*' in 'fac * A'
Is there a method to create an overloaded operator which
represents both left and right multiplication?
Kind regards
V.K.