Saturday 2 December 2017

C# Program to Demonstrate Multilevel Inheritance


Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Inherit
{
    class inheri : vehicle
    {
        public void Noise()
        {
            Console.WriteLine("All Vehicles Creates Noise !! ");
        }
        static void Main(string[] args)
        {
           inheri obj = new inheri();
            obj.mode();
            obj.feature();
            obj.Noise();
            Console.Read();
        }
    }
    class Mode
    {
        public void mode()
        {
            Console.WriteLine("There are Many Modes of Transport !!");
        }
    }
    class vehicle : Mode
    {
        public void feature()
        {
            Console.WriteLine("They Mainly Help in Travelling !!");
        }
    }
}


Output:

There are Many Modes of Transport !!
They Mainly Help in Travelling !!
All Vehicles Creates Noise !!


More C# Programs:



















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...