In this recipe, we will learn how to extend a class (Inheritance) and how to extend the functionality of a class using Kotlin's Extension functions.
Inheritance is probably the first concept you learn in object-oriented programming. It is a mechanism where a new class is derived from an existing class. Via this, the classes may inherit or acquire the properties and methods of other classes. Extension functions, on the other hand, let us skip creating wrapper for functionality and enable us to add extra functions to the classes. Let's see both of them now.