Kotlin provides four types of inheritance:
- Single inheritance
- Multilevel inheritance
- Hierarchical inheritance
- Hierarchical multilevel inheritance
We will discuss each of these inheritance types in detail.
Kotlin provides four types of inheritance:
We will discuss each of these inheritance types in detail.
Single inheritance is the simplest form of inheritance, whereby a derived class has only one parent class. In the following diagram, class B is derived from class A, and class A is a superclass of class B. The programming and advanced programming examples in the property-overriding section were examples of single inheritance: