operator + method

Complex operator +(
  1. Complex b
)

Sum two complex number

Examples

var c1 = Complex(real: 1, imaginary: 1);
var c2 = Complex(real: 1, imaginary: 1);

print(c1 + c2);
/* output:
Complex(real: 2.0, imaginary: 2.0);
*/

Implementation

Complex operator +(Complex b) {
  return Complex(real: real + b.real, imaginary: imaginary + b.imaginary);
}