J
jraul
Suppose we have a complex number class and we overload the conversion
to double to return the real part. We also overload operator* to do
complex multiplication. Consider now:
complex a(...);
complex b(...);
complex c = a*b;
But the compiler complains ambiguity since it doesn't know whether to
do complex*complex, or convert to double first and do double*double.
Other than explicit casting is there a nice solution?
to double to return the real part. We also overload operator* to do
complex multiplication. Consider now:
complex a(...);
complex b(...);
complex c = a*b;
But the compiler complains ambiguity since it doesn't know whether to
do complex*complex, or convert to double first and do double*double.
Other than explicit casting is there a nice solution?