Hey John,
Try switching your parameter from "stat other" to "stat@ other".
I think opCmp wants a handle (by reference), not a by value object.
Best,
Aaron

On 2/17/16, john <jpcarnemo...@gmail.com> wrote:
> Hi all,
> I'm attempting to overload comparison operators in order to sort an array of
> objects, with the following function:
> //begin code
> int opCmp (stat other)
> {
> return percent-other.percent;
> }
> //end code
> However, the program gives me the following error as soon as comparison
> takes place:
> A runtime error occurred. File:function: void main()Description: Type 'stat'
> does not have a matching opCmp method
>
>
>
> Can anybody shed some light on this one?
>
>
>
> Thanks,
>
> John
>
>
>
> P.S:
>
> Yes, the comparison function is within the stat class, and comparison is
> being done by array.sort_descending.
>
> I have tried several case changes to the function name, and have stuck with
> the above because it matches both the manual and compiler error.
> ---
> Gamers mailing list __ Gamers@audyssey.org
> If you want to leave the list, send E-mail to
> gamers-unsubscr...@audyssey.org.
> You can make changes or update your subscription via the web, at
> http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
> All messages are archived and can be searched and read at
> http://www.mail-archive.com/gamers@audyssey.org.
> If you have any questions or concerns regarding the management of the list,
> please send E-mail to gamers-ow...@audyssey.org.
>

---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

Reply via email to