Why does Object.opEquals return int
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Mon Nov 13 12:34:51 PST 2006
Bill Baxter wrote:
> Also I you're free to make your own classes return bool
> from opCmp, it's just Object opCmp that returns int.
[You mean opEquals, of course]
Maybe you forgot that a "bool opEquals" doesn't override Object.opEquals
:( .
This means that any object ever compared as [1], well, an Object will
still need to define "int opEquals" or run into a potentially
hard-to-spot bug.
[1]: or /to/, if your "bool opEquals"'s parameter isn't an Object but
something else (such as a more derived type, typically that of your class).
More information about the Digitalmars-d
mailing list