Dilemma with "operator overloading"...
let's say we have a class Integer and we want to be able to add some two Integers (our objects) with operator "+" - so we overload the operator in our class:
But my question is:
// Operator "+"
operator+(const Integer& right) const
return Integer(i + right.i)
int i; // Some integer
Why the return value in operator+ function is const? Should I understand it, that the return value cannot be ever changed?
(Because in my opinion, from logic sight it doesn't get any meaning)