Conclusion

Let’s sum up what you learnt in this lesson:

  • Inheritance and polymorphism enable you to create flexible, reusable code.
  • In this lesson, you created a PublicDomainObject subclass of MuseumObject.
  • It has a property — primaryImageSmall — that isn’t in the parent class, so you defined its init method to set this property and call the parent’s init.
  • You redefined showImage(), then called this method from a MuseumObject and from a PublicDomainObject.
  • Each object behaved according to its type: The MuseumObject used SFSafariViewController, and the PublicDomainObject used MuseumObjectView
See forum comments
Download course materials from Github
Previous: Demo Next: Quiz: Inheritance & Polymorphism