mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
17 lines
360 B
Kotlin
Vendored
17 lines
360 B
Kotlin
Vendored
class Bar(val name: String)
|
|
|
|
abstract class Foo {
|
|
public abstract fun foo(): String
|
|
}
|
|
|
|
fun box(): String {
|
|
return object: Foo() {
|
|
inner class NestedFoo(val bar: Bar) {
|
|
fun copy(bar: Bar) = NestedFoo(bar)
|
|
}
|
|
|
|
override fun foo(): String {
|
|
return NestedFoo(Bar("Fail")).copy(bar = Bar("OK")).bar.name
|
|
}
|
|
}.foo()
|
|
} |