| 2 | #include <string> |
| 3 | |
| 4 | class NumberLike |
| 5 | { |
| 6 | public: |
| 7 | NumberLike(int n = 0) : mN(n) {} |
| 8 | NumberLike& operator+= (int i) |
| 9 | { |
| 10 | mN += i; |
| 11 | return *this; |
| 12 | } |
| 13 | std::string str() const |
| 14 | { |
| 15 | std::stringstream s; |
| 16 | s << mN; |
| 17 | return s.str(); |
| 18 | } |
| 19 | std::string repr() const |
| 20 | { |
| 21 | std::stringstream s; |
| 22 | s << "NumberLike("<< mN << ")"; |
| 23 | return s.str(); |
| 24 | } |
| 25 | private: |
| 26 | int mN; |
| 27 | }; |
| 28 | |
| 29 | NumberLike operator+(NumberLike n, int i) |
| 30 | { |