I read up on my subject heading a little bit more, and I just want to make sure I understand this correctly. It seems like the answer is that we still need to override equals on the class to define what the structural equality check is? So in other words if we want to check the customer1 == customer2
then we first have to define what structural equality is for Customer
by implementing equals, and at that point Kotlin will use our implementation by means of the ==
operator?
So in this case if Customer
inherits from Person
and we also want perform a structural equality check using properties from Person
then we would implement that in the equals(Object object)
method?