Delegate a method to another class
suggest changeinterface 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!
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents