Role of Inheritance in OOP

In the object oriented programming, objects will be characteristic by classes. It is probable to get familiar and learn a lot about an object based on the class it belongs to. Suppose I name Accord, and you are familiar of this name them you will not able know much about this but if I tell you that this is car then you have many rough idea about this that it has four wheels, an engine, and doors. Objected oriented programming takes this concept to a whole new level. It allows different classes to be defined in relations to other classes. For example, Mitsubishis sports cars and roadsters are all kinds of cars. In OOPs concept sports cars Mitsubishi and roadster are subclasses of the class cars.

In this car is having “superclass” of Mitsubishi, roadsters, and sports cars. Every subclass will inherit a state from the superclass. A variety of kinds of cars like Mitsubishi and roadsters will have some same behaviors like braking. In spite of this, subclasses are not limited to the behaviors and states which they have taken from their superclass. A subclass can unite methods and variables with the traits they have inherited from their superclass. As an example of software development , while a Mitsubishi might have four doors, sports cars will generally have two. It is also likely for subclasses to override any methods which they have inherited, and they can made exclusive implementations for these methods.

Software Development

As an instance of this, you can “override” definite traits inside a car to permit it to perform different things. It is also probable to employ more than just one level of inheritance. An inheritance structure can be created which can be as profound as you desire it to be. This inheritance arrangement is known as a class hierarchy. The variables and methods can widen throughout the levels of the class hierarchy. In many instances, a hierarchy which is bottomless tends to have behaviors that are different. Though, there are a number of significant software development things you must know about a class hierarchy. It must always classify what the classes are instead of how they have been utilized. And if you are implementing a class for sports cars then it the subclass of the class. The cause for this is since sports cars are a subgroup of the class cars which have need more large amounts of power and having fast speed. Since a sport cars is a group of the class cars you would not want to connect them together directly. If you carry this you may get confused those that use your program. They may since puzzle since the sports car might have methods that are not essential as the point of developer.