Inheritance
Inheritance is a mechanism through which a class can inherit the properties and functionalities of another class. If we have a set of common functionalities and data shared among multiple classes, we can put them in one class known as a parent or base class. Other classes can inherit these functionalities and data of the parent class as well as extending or modifying them and adding additional functionalities and properties. A class that inherits from another class is known as a child or derived class. Inheritance, therefore, facilitates code reusability.
In C#, inheritance is only supported for reference types. Only types defined as classes can be derived from other types. Types that are defined as structures are value types and cannot be derived from other types. However, all types in C# are either value or reference types and are indirectly derived from the System.Object
type. This relationship is implicit and does not require developers to do anything special.