Delegate a method to another class

suggest change
interface Foo {
    fun example()
}

class Bar {
    fun example() {
        println("Hello, world!")
    }
}

class Baz(b : Bar) : Foo by b

Baz(Bar()).example()

The example prints Hello, world!

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents