From f5331e02dd2e10c20cb562aa7940747e860411b0 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sat, 18 Nov 2017 14:56:31 +0100 Subject: Added pre-increment operator and += operator Signed-off-by: Olivier Gayot --- number.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'number.cpp') diff --git a/number.cpp b/number.cpp index c337a34..57dbcae 100644 --- a/number.cpp +++ b/number.cpp @@ -148,6 +148,25 @@ number::operator!=(const number &n) const return _operands != n._operands; } +/* }}} */ +/* Assignment operators {{{ */ + +number & +number::operator+=(const number &n) +{ + *this = *this + n; + + return *this; +} + +number & +number::operator++() +{ + *this = *this + 1; + + return *this; +} + /* }}} */ std::ostream & -- cgit v1.2.3