[fpc-devel]Operator overloading question.

BiPolar BiPolar at SoftHome.net
Fri Nov 7 18:50:09 CET 2003


Peter Vreman wrote:

> class=class operatorion is handled by the compiler and can't be
> overloaded.

Clear as water. Maybe you could include this explanation on the docs, 
so people like me (new to operator overloading) doesn't ask again.

> what do you want to compare? the address of the class or the contents 
> of
> the class (like you overloaded example). And how to handle child 
> classes?
> Do the need to be implicitly cast to tsomeclass first or do you want 
> the
> pointer comparison only.

As I'm working on a pascal wrapper for a C++ API, I wanted to "emulate" 
as close as possible the C++ classes. And as some of those classes have 
some operators overloaded, I wanted to do the same on pascal. Of 
course, C++ operators where overloaded _inside_ of those classes.

Well, I'll have to wait for an "operator TMyClass.= (a, b : TMyClass) : 
Boolean;" :-)

Thanks.

Oscar Lesta.




More information about the fpc-devel mailing list