![]() |
![]() |
![]() |
![]() |
![]() |
|
The == and = predicates behave differently for points because
of the way = is defined for the Point class. Otherwise, the
= predicate would be inherited from the Object class, in
which the = predicate is defined to provide the same answers as the
== predicate.
Thus, if you want the = predicate to answer true if two
instances have the same instance-variable values, you must provide a
definition that overrides the definition provided in the Object
class. In that definition, you must decide whether having the same
instance-variable values means having identical values or having equal
values.