Tristan Caron
04/09/2018, 10:24 AM.copy()
provided by data class, but the result is not really what I want.
data class Person(val name: String = "Tristan") {
var age: Int = 1
}
fun main(args: Array<String>) {
val person = Person()
person.age = 3
val personCloned = person.copy()
println(personCloned.age) // It prints 1 and I was expecting 3
}
Can you give me some lights on it? Thank you.