double square(double x) { return x * x; } Complex square(Complex x) { return new Complex( square(x.real) + square(x.imaginary), 2 * x.real + x.imaginary); }