Hacker News new | ask | show | jobs
by eiffel31 3090 days ago
> class A(b: B) : B by b // IS_A via composition

I couldn't find the "B by b" syntax from the Kotlin docs, can you tell me that this does ?

1 comments

It's delegation.

Look at page 96 of this PDF file: https://kotlinlang.org/docs/kotlin-docs.pdf

Thank you, wish Java had this :'(