[Prev][Next][Index]
operator overload problem
- Date: Tue, 31 Jan 1995 14:11:32 -0600
- From: lu sun <ls2885@coewl.cen.uiuc.edu>
- To: sage-bugs@cica.indiana.edu
- Subject: operator overload problem
- Cc: ls2885@coewl.cen.uiuc.edu
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