So now continuing to the Blog series I will talk about the inheritance concept in this post. In previous blogs, we have seen how to create classes and objects and we can create as many classes as we want. But sometimes we observe that many classes have some properties same as another class. We should keep in mind a fact that creation of an object in memory is a very expensive task and we have to minimize it so one of the methods to do so is Inheritance. So there are two terms: Parent Class and Child Class. The parent class has some features and the child class has similar features along with some extra specific features and the child can be inherited from the parent class so that there is no redundancy. Image source Google So talking about the above image we can see that the vehicle is the parent class and then the car, motorcycle, truck are child class of vehicle and following that again station wagon, jeep are the child class of car and so on. ...
A Blog Series For Introducing Programming Related Topics...