Types of Inheritance in C#


In C#, the classes can be reused in several ways. Re-usability is achieved by designing new classes, and reusing all or some of the properties of existing ones. The mechanism of designing or constructing one class from another is called Inheritance. There are mainly four Types of Inheritance in C#.

i. Classical Inheritance: It represents a kind of relationship between two classes.

ii. Containment Inheritance: It can also define another form of inheritance relationship known as containership between two classes.

iii. Multi-Level Inheritance: A derived class with multi-level base classes. This process may be extended to any number of levels. It is called Multi-Level Inheritance.

iv Hierarchical Inheritance: In this inheritance, it having one superclass and many subclasses. It supports the hierarchical design of a program.