Equality testing is another area where the language designer can choose to use either pointer or value semantics. A pointer test is sometimes called an identity test, and simply asks ``are the left and right arguments referring to exactly the same object''. This is the meaning of the = operator in Java, for example.
The other alternative is to compare data fields, perhaps recursively, and ask not whether the left and right values are the same object, but whether or not they are equivalent to each other. This is, for example, the meaning of the equals operator in Java.
Inheritance and operator overloading can both complicate things considerably. If programmers can define new meanings for equality, then there is no guarantee that even such simple properties as communtatively will be preserved. It can happen that x is equal to y, but y is not equal to x.