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:
parent
f03784b6c1
commit
976f6913db
|
@ -4,3 +4,8 @@ int Calculator::Add (int a, int b)
|
||||||
{
|
{
|
||||||
return a + b;
|
return a + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Calculator::Sub (int a, int b)
|
||||||
|
{
|
||||||
|
return Add (a, -b);
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ class Calculator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int Add (int, int);
|
int Add (int, int);
|
||||||
|
int Sub (int, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif//CALCULATOR_H
|
#endif//CALCULATOR_H
|
||||||
|
|
Loading…
Reference in New Issue