So far, we have created classes to generate blueprints for real-life objects. Now, it is time to take advantage of the more advanced features of object-oriented programming and start designing a hierarchy of classes instead of working with isolated classes. First, we will design all the classes that we need based on the requirements, and then, we will use the features available in Swift to code the design.
We worked with classes to represent superheroes. Now, let's imagine that we have to develop a very complex app that requires us to work with hundreds of types of domestic animals. We already know that the app will start working with the following four domestic animal species:
Dog (Canis lupus familiaris)
Guinea pig (Cavia porcellus)
Domestic canary (Serinus canaria domestica)
Cat (Felis silvestris catus)
The previous list provides the scientific names for each domestic animal species. Of course, we will work with the most common...