operator + method

Rat operator +(
  1. Rat other
)

Adds this Rat to other.

Implementation

Rat operator +(Rat other) {
  return Rat(n * other.d + other.n * d, d * other.d);
}