operator - method

Complex operator -(
  1. Complex b
)

Subtract two complex number

Examples

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

print(c1 - c2);

/* output:
Complex(real: 0.0, imaginary: 0.0)
*/

Implementation

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