Well, when someone goes to heaven, they leave beh...
Father, I mean object oriented inheritance.
Ah yes, of course. In a sentence, it is basing an object or a class upon another class.
The parent class define the fields and methods which will be used in the child class.
Allow me to use an example using the language of the Lord... C#. Let's say you have a class for shapes, you can define fields for the height and width of each shape, as well as its color. You can also have a draw method to tell the shape to draw. Now individual shape classes can inherit the fields and methods of the parent (or base) class without having to redefine each field and method.
Wow, that is efficient. Thus, if I want to draw a rectangle I can just inherit the width and height from the parent class! But Father, what about the draw method? It would have to be different for different types of shapes, right? A rectangle is not drawn the same way as a triangle.
Well observed, young Codeawan. The draw method in the rectangle class would have to override the draw method in the shapes class. Alternatively, we could define an abstract draw method in the shapes class as a placeholder for the child classes to define their own draw methods. Let us step into the realm of code for a concrete example.