Joe
02/24/2018, 1:01 AMCzar
02/24/2018, 1:14 AMCzar
02/24/2018, 1:18 AMopen class A
class B : A() {
fun test() { println("child member") }
}
fun A.test() { println("extension") }
val v: A = B()
v.test()
//result:
extension
Czar
02/24/2018, 1:19 AMv
is declared as A
, even though at runtime it is actually B, the test
function was resolved at compile time statically to the extension fun.Joe
02/24/2018, 1:22 AMCzar
02/24/2018, 1:23 AM