// Rationalv2.cpp #include "Rationalv2.h" bool Rational::set(int n, int d) { if (d != 0) { num_ = n; den_ = d; return true; } else return false; } Rational Rational::operator+(const Rational &r2) const { Rational r; r.num_ = num_ * r2.den_ + den() * r2.num(); r.den_ = den_ * r2.den_; return r; }