Summary

In this chapter, you learned about the declaration and combination of multiple blueprints to generate a single instance. We declared protocols with different types of requirements. Then, we created many classes that conformed to these protocols.

We worked with type casting to understand how protocols work as types. Finally, we combined protocols with classes to take advantage of multiple inheritance in Swift 3. We combined inheritance for protocols and classes.

Now that you have learned about protocols, multiple inheritance, and contract-based programming, we are ready to maximize code reuse with generic code and parametric polymorphism.

Get Swift 3 ObjectOriented Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.