[Prev][Next][Index]

operator overload problem




I had some problem with the operators(+-*/) overloading for classes inheriting
from FArray classes.  I then tried to overload the operators directly to classes
like FArrayFloat.   Here is my demonstrative code:

#include "FArray.h"
...

FArrayFloat operator+(FArrayFloat& x, FArrayFloat& y)
{
...
}

void Processor_Main()
{
...
}


Then I checked the temp.C which was generated by pc++.  I noticed these lines:
...
Complex sqrt(const Complex &x);
Complex operator -(const Complex &x);
FArrayFloat operator +(double x, const Complex &y);
Complex operator -(double x, const Complex &y);
Complex operator *(double x, const Complex &y);
Complex conj(const Complex &x);
...

Why the declaration for Complex operator +(double x, const Complex &y) is
replaced by FArrayFloat operator +(double x, const Complex &y);? 

-Lu Sun