+ 2
structural equality kotlin
what are some examples of structural equality
1 Antwort
0
Classes contain data properties. They also can define a comparison method. The method would look at the properties to decide that the data is the same. Passing the test as equal defines equality. It does not mean all properties have the same values as there could be maintenance properties that are not compared. An example using the Int class:
val one = 1
if (one == 1)
print("structural equality")