How do extension functions work?

As the docs say: "Extension functions are resolved statically", i.e. they are normal static methods bearing no connection with the class they are extending, other than taking an instance of this class as a parameters. http://confluence.jetbrains.com/display/Kotlin/Extension+functions

Answering your second queations: extensions must be in scope, i.e. if they are not visible statically, you have to import them.

1 Like