Operator overloading problem

Jonathan M Davis jmdavisprog at gmail.com
Fri Aug 6 12:53:16 PDT 2010


On Friday, August 06, 2010 12:30:38 Blonder wrote:
> Hello,
> 
> can someone help me with this?
> 
> struct Group {
>     int i1;
>     Group opBinary(string op)(int x) {
>         // do somehting
>         return this;
>     }
>     Group opBinary(string op)(Group g) {
>         // do something
>         return this;
>     }
> }
> 
> 
> Group g, h;
> g.i1 = 1;
> 
> h = g+g;

I think that you need to be more specific with your question. What exactly do you 
want help with? Are you trying to figure out how operator overloading works? Are 
you trying to figure out how it would be specifically done in this case? What 
exactly are you looking for help with?

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list