...

/

Quiz: Operator Overloading

Quiz: Operator Overloading

Test your understanding of the concepts discussed in this chapter.

We'll cover the following...
Technical Quiz
1.

In Kotlin, which method should be defined in a class to be able to use the - operator on its instances?

data class Complex(val real: Double, val imaginary: Double) {
    operator fun ____(another: Complex) = Complex(
        real - another.real,
        imaginary - another.imaginary
    )
}
A.

minus

B.

subtract

C.

minusAssign

D.

-


1 / 5
...