+ operator with reference parameters can not be chained
Hi!
this doesn't compile:
1 2 3 4 5 6 7 8
|
class myclass{};
myclass operator+(myclass &a, myclass &b){
return a;
}
myclass a,b,c,d;
d = a+b+c;
|
when I change
d = a+b+c;
into
d = a+b;
then it compiles and if I change
operator+(myclass &a, myclass &b)
into
operator+(myclass a, myclass &b)
it also compiles.
What is the problem here?
Best regards,
Mirko
myclass operator+(const myclass &a, const myclass &b){
Topic archived. No new replies allowed.