Operator overloading problem

Blonder andreas at schniertshauer.de
Fri Aug 6 13:08:37 PDT 2010


Hello, I am trying to understand how operator overloading works with D. I am a C++
programmer and I am reading the book of Andrei Alexandrescu and try to understand
D and it's language features.

My Group example don't compile, the error is:
Error: template instance opBinary!("+") matches more than one template
declaration, ...

I know that it matches more than one, that was my intention, because I want to be
able to write also

h = g+2 for example.

Is this possible in D?
Can you help me?
Thanks,
Andreas.


More information about the Digitalmars-d-learn mailing list