...

/

Challenge: Operator Overloading

Challenge: Operator Overloading

Test your understanding by solving the challenge given in this lesson.

Problem statement

In this challenge, we want to multiply two complex numbers by overloading the * operator.

Multiplication between complex numbers takes place as illustrated in the example below:

In general,

(a+bi)(c+di)=acbdreal+(ad+bc)iimaginary(a+bi)(c+di) = \underbrace{ac-bd}_{real}+\underbrace{(ad+bc)i}_{imaginary} ...