Why does this opCmp function not work

Ruby The Roobster michaeleverestc79 at gmail.com
Wed Sep 23 11:19:15 UTC 2020

On Wednesday, 23 September 2020 at 10:38:42 UTC, Stefan Koch 
> Equality is defined by opEquals.
> Which for classes defaults to pointer identity comparison.
Using opEquals, it still returns false. Does this have something 
to do with volume being a property?:

int volume() @property

note that this returns true:
but not this:
test == test1

here is the function:
bool opEquals(shape rhs)
return(rhs.volume == this.volume);
despite the fact that x == y should be the same as x.opEquals(y),
calling opEquals directly returns true, but otherwise it returns 
also, compiler complains if I don't have this alias: alias 
opEquals = Object.opEquals. that might have something to do with 

More information about the Digitalmars-d mailing list