Conclusion
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.