Files
kotlin-fork/backend.native/tests/codegen/delegatedProperty/map.kt
T
2017-10-20 18:25:05 +03:00

17 lines
357 B
Kotlin

package codegen.delegatedProperty.map
import kotlin.test.*
class User(val map: Map<String, Any?>) {
val name: String by map
val age: Int by map
}
@Test fun runTest() {
val user = User(mapOf(
"name" to "John Doe",
"age" to 25
))
println(user.name) // Prints "John Doe"
println(user.age) // Prints 25
}