Operator overloading problem

Blonder andreas at schniertshauer.de
Fri Aug 6 12:30:38 PDT 2010


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;


More information about the Digitalmars-d-learn mailing list