Any object-oriented programming language has some form of class inheritance. Let me revise:
Imagine you had to program a bunch of fruit: Apples, Oranges and Pears. They all differ in size, shape and color, that's why we have different classes.
But let's say their differences don't matter for a second and you just want a Fruit, no matter which exactly? What return type would getFruit() have?
The answer is class Fruit.
We create a new class and make all fruits inherit from it!
| Parameter | Details |
|---|---|
| Base Class | Class that is inherited from |
| Derived Class | Class that inherits from Base Class |
| Init Arguments | Arguments passed to constructor of Base Class |
| Function Definition | Function in Derived Class that has different code than the same in the Base Class |
| DC-Object | ”Derived Class-Object“ Object that has the type of the Derived Class |