C#

What is Inheritance!

What is Inheritance
Written by shohal

Inheritance

Taking the properties of one class into another class is called inheritance.

Types of inheritance in C#

Single

Hierarchical

Multilevel

Multiple inheritance using Interfaces

Single inheritance 

•It is the type of inheritance in which there is one base class and one derived class.

image 1
Hierarchical inheritance

•This is the type of inheritance in which there are multiple classes derived from one base class. This type of inheritance is used when there is a requirement of one class feature that is needed in multiple classes.

image 2
  Multilevel inheritance

•When one class is derived from another derived class then this type of inheritance is called multilevel inheritance.

image 3

Multiple inheritance using Interfaces

•C# does not support multiple inheritances of classes. To overcome this problem we can use interfaces, we will see more about interfaces in my next article in detail.

image 4

About the author

shohal

Leave a Comment