operator + method

Power operator +(
  1. Power other
)

Adds this power to another power.

The other power is converted to the unit of this power before addition. The result is a new Power instance with the sum, expressed in the unit of this power (the left-hand operand).

Implementation

Power operator +(Power other) {
  final otherValueInThisUnit = other.getValue(unit);
  return Power(value + otherValueInThisUnit, unit);
}