PROPOSAL: Operator overloading by static member function

Janice Caron caron800 at googlemail.com
Sun Oct 14 06:36:32 PDT 2007


On 10/14/07, oldrev <oldrev at gmail.com> wrote:
> Noway, when you overloading a binary operator, it must has a Currency parameter at least.

Aha. I thought you might say that, so I've already planned out my
response. If one of the parameters /has/ to be a Currency, then the
best way to ensure that is to ditch the word "static", and bingo! -
one Currency parameter /automatically/ at your disposal (it's called
"this"). Job done.

Of course, you still need to distinguish LHS from RHS, but that can be
done easily and simply just by suffixing "_r" to the function name in
the latter case.

I call this new, revised proposal, the "status quo". :-)



More information about the Digitalmars-d mailing list