Swift 3 Object-Oriented Programming by Gastón C. Hillar

Swift 3 Object-Oriented Programming by Gastón C. Hillar

Author:Gastón C. Hillar
Language: eng
Format: epub
Publisher: Packt Publishing


Tip

Protocols in Swift allow us to make sure that the classes that implement them define all the members specified in the protocol. If they don't, the code won't compile.

In this case, the ComicCharacter protocol didn't specify any initializer requirements, so each class that conforms to the protocol can define its initializer without any constraint. AngryDog and AngryCat declare initializers with a different number of arguments.

Taking advantage of the multiple inheritance of protocols



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.