diff options
-rw-r--r-- | number.cpp | 12 | ||||
-rw-r--r-- | number.h | 8 |
2 files changed, 20 insertions, 0 deletions
@@ -92,6 +92,18 @@ number::operator+(const number &n) const return result; } +number +number::operator*(const number &n) const +{ + number result; + + for (number i; i < n; ++i) { + result += *this; + } + + return result; +} + /* }}} */ /* Comparison operators {{{ */ @@ -33,6 +33,14 @@ public: number operator+(const number &n) const; /** + * \brief Return the result of the multiplication of a number and this + * number. + * + * \param n The number to multiply with this number. + */ + number operator*(const number &) const; + + /** * \brief Tells whether the number passed as parameter is strictly less * than this number. * |