Skip to content

Types of Inheritance

Inheritance can be categorized into different types based on how many parent and child classes are involved. Understanding these types helps you design class hierarchies effectively.


graph TD
Types["Types of Inheritance"]
Types --> Single["Single Inheritance<br/>One parent, One child"]
Types --> MultiLevel["Multilevel Inheritance<br/>Chain: A → B → C"]
Types --> Hierarchical["Hierarchical Inheritance<br/>One parent, Many children"]
Types --> Multiple["Multiple Inheritance<br/>Many parents, One child"]
Types --> Hybrid["Hybrid Inheritance<br/>Combination of types"]
Single --> S1["✅ All OOP languages"]
MultiLevel --> M1["✅ All OOP languages"]
Hierarchical --> H1["✅ All OOP languages"]
Multiple --> M2["⚠️ Python, C++ only<br/>Not in Java, JS, C#"]
Hybrid --> H2["⚠️ C++ only"]

Full details →

One child class inherits from one parent class.

class Parent { /* ... */ }
class Child extends Parent { /* ... */ }

Supported by: All OOP languages (JavaScript, TypeScript, Python, Java, C#)


Full details →

A chain of inheritance where class C inherits from class B, which inherits from class A.

class Animal { /* ... */ }
class Mammal extends Animal { /* ... */ }
class Dog extends Mammal { /* ... */ }

Supported by: All OOP languages


Full details →

One parent class has multiple child classes.

class Animal { /* ... */ }
class Dog extends Animal { /* ... */ }
class Cat extends Animal { /* ... */ }
class Bird extends Animal { /* ... */ }

Supported by: All OOP languages


Full details →

One child class inherits from multiple parent classes.

// Not supported in JavaScript, TypeScript, Java, C#
// Supported in Python, C++
class Child extends Parent1, Parent2 { /* ... */ }

Supported by: Python, C++ (not Java, JS, C#)


Full details →

A combination of multiple inheritance types — can lead to the diamond problem.

Supported by: C++ (rarely used)


TypeUse Case
SingleMost common — simple IS-A relationship
MultilevelWhen each level adds more specificity
HierarchicalWhen one concept has multiple variations
MultipleWhen a class needs capabilities from multiple sources (use interfaces instead)
HybridAvoid if possible — too complex

Previous Topic: Inheritance Overview → Next Topic: Single Inheritance →