Why does this opCmp function not work

Ruby The Roobster michaeleverestc79 at gmail.com
Wed Sep 23 13:16:17 UTC 2020


On Wednesday, 23 September 2020 at 11:28:11 UTC, Simen Kjærås 
wrote:
> A correct implementation would be:
>
> override bool opEquals(Object o) {
>     if (!cast(Shape)o) return false;
>     return (cast(Shape)o).volume == this.volume;
> }
>
> --
>   Simen

Thanks. This solved the problem.


More information about the Digitalmars-d mailing list