Inheritance
Inheritance is one of the most important features/concepts of OOP. It is self-explanatory in name; inheritance inherits features from a class. In simple words, inheritance is an activity performed at compile-time as instructed with the help of the syntax. The class that inherits another class is known as the child or derived class, and the class which is being inherited is known as the base or parent class. Here, derived classes inherit all the features of base classes either to implement or to override.
In the coming sections, we will discuss inheritance in detail with code examples using C#.
Understanding inheritance
Inheritance as a feature of OOP helps you to define a child class. This child class inherits the behavior of the parent or base class.
Note
Inheriting a class means reusing the class. In C#, inheritance is symbolically defined using the colon (:) sign.
The modifier (refer to Chapter 2, Day 02 - Getting Started with C#) tells us what the scope of the reuse of the base...