opEquals footprint

Erik Rasmussen i_am_erik at yahoo.com
Wed Mar 22 06:55:23 PST 2006


I've looked all around in the documentation and forum discussions, and I 
can't find the answer to this simple, but all-important question:

***** What should the type of the parameter to opEquals be??? *****

I can see two possibilities:

A) Object.  This would force you to check the type of the object passed 
in as part of your equivalence check.  Could this perhaps be done at 
compile-time with an is() expression?

B) The same type as the class.  This is fine, but I don't think 
subclasses properly override the superclass's opEquals implementations 
when this is the case.

Can someone settle this?  What is the proper way to implement opEquals??

Thanks,
Erik



More information about the Digitalmars-d-learn mailing list