• Home
  •  Interface and Multiple Inheritance through Interfaces

 Interface and Multiple Inheritance through Interfaces

Agenda

Interface in C#

Example:

interface Vehicle

{ void engine();

void wheels();

void frontlight();

void backlight();

void horn();

void seat();

}

Abstraction Example in C#

interface LuxaryPersonalCar
{ void ac();

void music(); }
public class Car : Vehicle, LuxaryPersonalCar
{ public void backCamera()

{ Console.WriteLine("Good Quality back camera"); //method specific to Class }
public void ac()

{ Console.WriteLine("Good Quality AC Serice"); }
public void backlight()

{ Console.WriteLine("2 Backlight"); }
public void engine()

{ Console.WriteLine("1200 CC Engine"); }
public void frontlight()

{ Console.WriteLine("2 Front Light"); }
public void horn()

{ Console.WriteLine("Good Quality 1 horn"); }
public void music()

{ Console.WriteLine("Good Quality Music Player"); }

public void seat()

{ Console.WriteLine("Total 5 Adult Seats"); }
public void wheels()
{ Console.WriteLine("Total 5 Wheels"); } }
static void Main()

{ Car hyndaii20 = new Car();
hyndaii20.horn();
hyndaii20.engine();

hyndaii20.ac();

hyndaii20.seat();

hyndaii20.backCamera(); }