Conclusion
Heads up... You’re accessing parts of this content for free, with some sections shown as text.
Heads up... You’re accessing parts of this content for free, with some sections shown as 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
PublicDomainObjectsubclass ofMuseumObject. - 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 aMuseumObjectand from aPublicDomainObject. - Each object behaved according to its type: The
MuseumObjectusedWebViewComposable, and thePublicDomainObjectusedMuseumObjectComposable.