Conclusion

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Here’s what you learned in this lesson:

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