‫Welcome back.
‫In this video we're going to learn about a very important concept in Kotlin which is the inheritance.
‫Inheritance is a fundamental concept in object oriented programming, and it allows one class to inherit
‫the properties and behaviors of another class.
‫Suppose in our application we want three robots, three different types of robots.
‫The first one is the ordinary robot that walks, speaks and turn on the light.
‫The second type is the super robot that walks, speaks, and cleans the house.
‫The third type is the firing robot that walks, speaks, and fires.
‫Since all of the robot types can walk and talk.
‫So there is a common between all of these types.
‫However, they also have some special skills like the ordinary robot turns on the light, the super
‫robot cleans the house.
‫The firing robot fires.
‫In each of these classes, you would be copying the same code to walk and speak the problem.
‫If you want to add a new feature called shutdown, you need to implement the same code for each robot.
‫Moreover, we need to duplicate the code for walk method, speak method and shut down method.
‫So we need to create three classes with duplicate codes for walk, speak and shutdown method.
‫It would be easier if we had a general robot class with basic features like walk and speak, and classes
‫with the special skills for every kind of the robot.
‫This is done by using the inheritance.
‫Using inheritance.
‫Now you don't implement the same code for walk and speak methods for each class.
‫You just need to inherit them.
‫This makes your code cleaner, understandable, and extendable.
‫It's important to remember when working with inheritance.
‫Each derived class should satisfy the condition whether it is is a base class or not.
‫In this example, the robot is a general robot.
‫The super robot is a general robot.
‫Firing robot is a general robot.
‫So is a relationship is the key for the inheritance.
‫In the next video we're going to implement this inheritance example.