16 lines
245 B
Kotlin
16 lines
245 B
Kotlin
package funinterfaces
|
|
|
|
fun interface FunInterface {
|
|
fun run(): Int
|
|
}
|
|
|
|
fun getObject(): FunInterface {
|
|
return object : FunInterface {
|
|
override fun run() = 1
|
|
}
|
|
}
|
|
|
|
fun getLambda(): FunInterface {
|
|
return FunInterface { 2 }
|
|
}
|