| // FILE: Delegation.java | |
| package test; | |
| class JavaClass { | |
| public static void main(String[] args) { | |
| Test test = new Test(); | |
| test.foo(); | |
| test.getBar(); | |
| } | |
| } | |
| // FILE: Delegation.kt | |
| package test | |
| interface Trait { | |
| fun foo() | |
| val bar: Int | |
| } | |
| class Impl: Trait { | |
| override fun foo() {} | |
| override val bar = 1 | |
| } | |
| class Test : Trait by Impl() |