How to Compare 2 objects of the same class

Mark via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 3 15:38:31 PDT 2017


On Saturday, 3 June 2017 at 20:24:44 UTC, ag0aep6g wrote:

> By default, they act the same. But you can change how `==` 
> behaves by overriding `opEquals`. You cannot override `is`.



Ok. So by using '==' it should compare the addresses of the 
objects?

I think I didn't include the other file as an argument on the 
command line (Oops!)

I'm using dmd v2.074.0.

In the future I'll include a compilable example. I was having 
problems with a class I made which is about 45 lines, that might 
be a lot of code for a post.

But it seems to work now. This is good, I can have the 
comparisons work for any type without doing backflips.


Thanks.


More information about the Digitalmars-d-learn mailing list