C# program for Hierarchical Inheritance
Program.cs
WhiteBank wb = new WhiteBank();
GreenBank gb = new GreenBank();

wb.Bonus();
wb.WhiteBankBonus();

gb.Bonus();
gb.GreenBankBonus();

class Bank
{
    public void Bonus()
    {
        Console.Write("Festival Bonus: ");
    }
}
class WhiteBank : Bank
{
    public void WhiteBankBonus()
    {
        Console.WriteLine("WhiteBank 1500");
    }
}
class GreenBank : Bank
{
    public void GreenBankBonus()
    {
        Console.Write("GreenBank 500");
    }
}
Output
kodingwindow@kw:~/csharp$ dotnet run
Festival Bonus: WhiteBank 1500
Festival Bonus: GreenBank 500
kodingwindow@kw:~/csharp$ 
Advertisement