Overloading with extension functions

We already said how it would be better to use operators instead of functions when working with the BigInteger class. Operator overloading also works with extension functions, and this enables you to overload operators on types that are defined in other libraries.

Here's how the Kotlin standard library overloads the * operator:

public inline operator fun BigInteger.times(other: BigInteger): BigInteger = this.multiply(other)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.24.118