We also want to be able to increase the value of the
age property of the different
Animal instances by using the addition assignment operator (
+=). This operator is one of the compound assignment operators that Swift provides and it combines assignment (
=) with the addition operator (
Swift 3 removed both the pre-increment, post-increment, pre-decrement, and post-decrement operators. In other words, we cannot use
-- in Swift 3. We might define a prefix increment and a postfix increment to increase the value of the
age property, but it doesn't make sense to define an operator that Swift 3 has removed. Instead, we will use the addition assignment operator.
We have to declare an operator ...