struct Test {
int A = 0;
int B = 0;
};
Test* operator+(const Test *x, const Test *r) {
Test *test = new Test;
test->A = x->A + r->A;
test->B = x->B + r->B;
return test;
}
Why this wont work and give's :
3 IntelliSense: nonmember operator requires a parameter with class or enum type
a + b + c? Or if you want to use addition as part of another expression, e.g. as argument to a function call? You're going to split it up into multiple statements and temporary variables too? Lot of work for something that should be simple.