Does kotlin accept Class Delegation using `object`...
# announcements
s
Does kotlin accept Class Delegation using
object
? The following code compile.
Copy code
interface I {
    fun foo()
}

object O : I {
    override fun foo() {
        println("Foo!!!")
    }
}

class C : I by O

fun main(args: Array<String>) {
    C().foo() // Foo!!!
}
r
shiraji: I don't know why that shouldn't work. An object is just a a Singleton that behaves just like a regular class instance otherwise.
s
@robin I just have never seen this before.
This is totally expected behavior, then