add a subtraction operation

Add member-function which performs a subtraction in terms of
an addition.

Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
This commit is contained in:
Sergii Piatakov 2018-11-15 15:17:29 +02:00
parent f03784b6c1
commit 976f6913db
2 changed files with 6 additions and 0 deletions

View File

@ -4,3 +4,8 @@ int Calculator::Add (int a, int b)
{
return a + b;
}
int Calculator::Sub (int a, int b)
{
return Add (a, -b);
}

View File

@ -5,6 +5,7 @@ class Calculator
{
public:
int Add (int, int);
int Sub (int, int);
};
#endif//CALCULATOR_H