Swift doesn't allow us to declare a class with multiple base classes or superclasses, so there is no support for multiple inheritance of classes. A subclass can inherit just from one class. However, a class can conform to one or more protocols. In addition, we can declare classes that inherit from a superclass and conform to one or more protocols. Thus, we can combine class-based inheritance with protocols.
We want the
AngryCat class to conform to both the
GameCharacter protocols. Thus, we want to use any
AngryCat instance as both a comic character and a game character. In order to do so, we must change the class declaration and add the
GameCharacter protocol to the list ...