Add the following operators to work with both
==: This determines whether all the elements that compose a 3D vector (
z) are equal.
+: This sums each element that composes a 3D vector and saves the result in each element or in the new returned instance according to the class version (mutable or immutable). The new
xmust have the result of the left-hand side
x+ right-hand side
x, the new
ymust be that of the left-hand side
y+ right-hand side
y, and the new
zmust be that of the left-hand side
z+ right-hand side
In Chapter 4, Inheritance, Abstraction and Specialization, we created an
Animal class and then defined specific operator functions to allow us to use operators with instances ...