Write a C# program to demonstrate the multiple inheritances
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();
}
}
}
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:
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 to count vowels in a string
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
Pingback: C# Program that read array display the smallest integer and sort the array in ascending order by using Array.Sort method.
Pingback: C# windows form application that converts the temperature from Fahrenheit to Celsius
Pingback: Top 20 C# programs examples in 2021