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
This content was released on Oct 17 2023. The official support period is 6-months
from this date.
Inheritance and Polymorphism Conclusion.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.