SEARCH C# PROGRAMMING CODES HERE

Multi-level Inheritance

Multi-level Inheritance in C#
When one class acquires another class which is additionally acquired by another class, in this case, we will call it Multi-level Inheritance. Inheritance is transitive so the last decided class secures all of the information from all its base classes.so let's clear out through the program and simply copy the yellow highlighted code as follows.

Program

using System;
namespace program
{
    public class Car      /*Base class */
    {
        public void BMW()
        {
            Console.WriteLine("Manufracturer- BMW_Ltd_Corporation");
            Console.WriteLine("Car_Brand - BMW");
        }
    }
    public class BMW_Feature : Car
    {
        public void feature()
        {
            Console.WriteLine("Avalble_Color- Black,Blue,Red,White ");
            Console.WriteLine("Max_Speed - 200 MPH ");
            Console.WriteLine("Price=23,00000");
        }
    }
    public class Detail: BMW_Feature /*Derived class */
    {
        public void Bmw_Detail()
        {
            BMW();
            feature();
        }
    }
   
    class Inheritance
    {
        class Program
        {
            static void Main(string[] args)
            {
    /*Calling all the base classes members using drived class*/
             Detail Car = new Detail();
             Car.Bmw_Detail();
             Console.ReadKey();
            }

        }
    }
}

Now you can see in the above program last Derived class is Detail which acquires all the members of all its base classes.

Output
Manufacturer- BMW_Ltd_Corpration
Car_Brand -BMW
Available_Color-Black, Blue, Red, White
Max_Speed-200 MPH
Price-23,00000