C# program for Hybrid Inheritance (Multilevel and Hierarchical)
Program.cs
GreenBank gb = new GreenBank();
gb.GreenBankBonus();
gb.WhiteBankBonus();

PinkBank pb = new PinkBank();
pb.PinkBankBonus();
pb.WhiteBankBonus();

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

kodingwindow@kw:~/csharp$ 
What Next?
C# Polymorphism
Advertisement