O'Reilly logo

Swift 3 ObjectOriented Programming - Second Edition by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary

In this chapter, you learned how to maximize code reuse by writing code capable of working with objects of different types, that is, instances of classes that conform to specific protocols or whose class hierarchy includes specific superclasses. We worked with protocols and generics. We created classes capable of working with one or two constrained generic types.

We combined inheritance, protocols, and extensions to maximize the reusability of code. We could make classes work with many different types.

Now that you have learned about parametric polymorphism and generics, we are ready to combine object-oriented programming and functional programming, which is the topic of the next chapter.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required