Hi all,
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:Code:class Integer { public: // Operator "+" const Integer operator+(const Integer& right) const { return Integer(i + right.i) } private: 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)
Thanks.
Petike