Conclusion
You’re approaching the end of this module and getting closer to becoming proficient in Kotlin Classes. This lesson gives you another aspect of this topic - the power of overriding.
In this lesson, you learned:
- Overriding methods is a powerful tool that promotes code reusability, flexibility and polymorphism.
- The
openmodifier on the method of a base class allows you to override it in a subclass. - Properties in constructors can also be overridden.
-
equals()andhashCode()are two methods responsible for class instance identity. - You can control how instances of a class are recognized as being the same or different by implementing the
equals()andhashCode(). - You can use
superto access the implementation of the base class.