Types of inheritance

Up until this point, we have got the idea about inheritance. Now, it's time to discuss inheritance types; inheritance is of the following types:

  • Single inheritance:

This is a widely used type of inheritance. Single inheritance is when a class inherits another class. A class that inherits another class is called a child class and the class which is being inherited is called a parent or base class. In the child class, the class inherits features from one parent class only.

C# only supports single inheritance.

You can inherit classes hierarchically (as we will see in the following section), but that is a single inheritance in nature for a derived class. Refer the following diagram:

The preceding diagram is a representation ...

Get Learn C# in 7 days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.