Challenge: Operator Overloading
Explore how to implement operator overloading in Kotlin by multiplying complex numbers. Understand the mathematical logic behind complex multiplication and apply it by defining the * operator within a Complex class to return correct results.
We'll cover the following...
We'll cover the following...
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,
...