Write a C# program to demonstrate the multiple inheritances

Write a C# program to demonstrate the multiple inheritances

Write a C# program to demonstrate the multiple inheritance

Object:

Write a C# program to demonstrates the multiple inheritances \ Multilevel inheritance in c# with example C# Projects with Source Code

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _22sep

{

    interface IName

    {

        void displayname(string a);

    }

    interface ILocation

    {

        void displaylocation(string b);

    }

    interface IAge

    {

        void displayage(string c);

    }

    class user: IName, ILocation, IAge

    {

        public void displayname(string a)

        {

            Console.WriteLine(“Name : “+a);

        }

        public void displaylocation(string b)

        {

            Console.WriteLine(“Location : ” + b);

        }

        public void displayage(string c)

        {

            Console.WriteLine(“Age : ” + c);

        }

    }

    class Program

    {

        static void Main(string[] args)

        {

            user u = new user();

            u.displayname(“James”);

            u.displaylocation(“Miami”);

            u.displayage (“20”);

            Console.ReadKey();

        }

    }

}

 

Output:

Write a C# program to demonstrate the multiple inheritances

Another C# Program: C# Program Calculating the Area of a Rectangle

Another C# Program: C# Program that Subtracts two user-defined numbers

Another C# Program: C# Program Create a class student with a data members name and calculate marks and percentage.

Another C# Program: C# program to count vowels in a string

Another Program: Write a C# program to create a static function factorial and calculate factorial of the number.

Another Program: Write a C# program that reads two arrays and checks whether they are equal.

Another Program: Develop a C# app that will determine the gross pay for each of three employees

M.A Siddiqui

Hi, I am M.A Siddiqui. I'm a Computer Science Student, In this website, I'm teaching you Multiple languages and provides Projects and other Subjects Notes.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *