Why does Object.opEquals return int

Bill Baxter wbaxter at gmail.com
Mon Nov 13 13:32:53 PST 2006


Frits van Bommel wrote:

> Not for classes to be used as an AA key. From 
> http://www.digitalmars.com/d/arrays.html#associative :
> -----
> *Using Classes as the KeyType*
> 
> Classes can be used as the KeyType. For this to work, the class 
> definition must override the following member functions of class Object:
> 
>     * hash_t toHash()
>     * int opEquals(Object)
>     * int opCmp(Object)
> 
> Note that the parameter to opCmp and opEquals is of type Object, not the 
> type of the class in which it is defined.
> -----

Huh, didn't know that.  Haven't done much with AA's yet.

--bb



More information about the Digitalmars-d mailing list