There are Many Modes of Transport !! They Mainly Help in Travelling !! All Vehicles Creates Noise !!
This is a C# Program to demonstrate multilevel inheritance.
This C# Program Demonstrates Multilevel Inheritance.
Here when a derived class is created from another derived class, then that inheritance is called as multi level inheritance.
Here is source code of the C# Program to Demonstrate Multilevel Inheritance. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Demonstrate Multilevel Inheritance */ 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 !!"); } } }
This C# program is used to demonstrate multilevel inheritance. Here when a derived class is created from another derived class, then that inheritance is called as multi-level inheritance. We have created a inherit namespace.
Create a class inheri() procedure that inherit the vehicle class. Create the variable ‘obj’ as an object for inheri() procedure . Using the ‘obj’ object variable we are calling the mode(), feature(), Noise() function.
There are Many Modes of Transport !! They Mainly Help in Travelling !! All Vehicles Creates Noise !!