Inheritance
Inheritance is the ability of classes to inherit things like methods and variables from another class. This means that you can create one parent class that has a method in it and all the classes that inherit from the parent class can use that method as if it belongs to them as well.The best way to explain inheritance is with an example. First we will create a class called ParentClass which has a method in it called SayHello() which prints "Hello" on the screen.
using System;
class ParentClass
{
public void SayHello()
{
Console.WriteLine("Hello");
}
}