As part of an assignment I am creating a class to handle rationals with numerators and denominators, overloading the operators for cin and cout, as well as +-*/. So these are the functions for those operators, now where exactly should I include these in my class?
Rational addition(Rational a, Rational b){
Rational result = Rational((a.numerator()*b.denominator() + b.numerator()*a.denominator()), a.denominator()*b.denominator());
return result;
}
Rational subtraction(Rational a, Rational b){
Rational result = Rational((a.numerator()*b.denominator() - b.numerator()*a.denominator()), a.denominator()*b.denominator());
return result;
}
Rational multiplication((Rational a, Rational b){
Rational result = Rational(a.numerator()*b.numerator(), a.denominator()*b.denominator());
return result;
}
Rational division((Rational a, Rational b){
Rational result = Rational(a.numerator()*b.denominator(), a.denominator()*b.numerator());
return result;
}