Sobes.tech
Junior — Senior

Checking equality of data class instances

livecode

Task condition

It is necessary to consider whether two objects of the same data class will be considered equal after changing their mutable property.

data class Person(val name: String) {
    var age: Int = 0
}

val personA = Person("John")
val personB = Person("John")

personA.age = 10
personB.age = 20

Question: will personA be equal to personB?