Comparing Instances of Classes

DRex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 10 08:36:17 PST 2017


On Friday, 10 March 2017 at 16:30:00 UTC, Adam D. Ruppe wrote:
> On Friday, 10 March 2017 at 16:22:18 UTC, DRex wrote:
>> Error: function app.A.opEquals does not override any function, 
>> did you mean to override 'object.Object.opEquals'?
>
> Oh sorry, maybe I messed up the const. Try:
>
> override bool opEquals(A rhs) { ... }
>
>
> and if the compiler still complains change the A to Object and 
> cast it inside (but I'm pretty sure that will work, I think it 
> is just const it is picky about)

Thanks.

I'm fairly new to D, but this seems to be quite a pain in the 
rear for a simple comparison of instances of classes...really odd 
that comparing instances of classes in D requires that messing 
around when D seems all about simplifying things...


More information about the Digitalmars-d-learn mailing list