Exercises
Add the following operators to work with both MutableVector3D<T> and ImmutableVector3D<T>:
==: This determines whether all the elements that compose a 3D vector (x,y, andz) 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 newxmust have the result of the left-hand sidex+ right-hand sidex, the newymust be that of the left-hand sidey+ right-hand sidey, and the newzmust be that of the left-hand sidez+ right-hand sidez.
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 of this class. Redefine this class to conform to both the Comparable and Equatable protocols.
The following lines show the source code for the Equatable protocol:
public protocol Equatable {
static func ==(lhs: Self...