Mahendran
09/06/2019, 10:25 AMCan Orhan
09/06/2019, 10:33 AMinterface MyInterface {
fun myFunction()
}
fun usesMyInterface(myInterface: MyInterface) { }
usesMyInterface(object : MyInterface {
override fun myFunction() {
}
})
Stephan Schroeder
09/06/2019, 10:52 AMfun main() {
usesMyInterface({name: String -> println("hello $name")} as MyInterface)
}
interface MyInterface {
fun myFunction(s: String)
}
fun usesMyInterface(myInterface: MyInterface) {
myInterface.myFunction("Yoda")
}
but throws an error. https://pl.kotl.in/_stgLor9VCan Orhan
09/06/2019, 10:59 AMSiebelsTim
09/06/2019, 11:00 AMCasey Brooks
09/06/2019, 2:12 PMtypealias MyInterface = (s: String)->Unit