Member-only story

Interface in c# , What is the use of Interface and example

Kajasumanie Kanapathipillai
3 min readMar 20, 2018

--

Before learn about interface ,we need to know about inheritance and their concept.inheritance means derived from other classes.if i inherit from parent class then the child class have all function of parent class.

There are five types of inheritance

source:http://a5theory.com/oops-concepts/
  1. Single Inheritance:extends one class form parent class.

for example

using System;namespace InheritanceDemo{public class Details{string name;string school;public void Program(string name, string school){this.name = name;this.school = school;Console.WriteLine(name +” at “+ school);}public class PrintDetails : Details{public void Print(){}static void Main(string[] args){Details obj = new Details();obj.Program(“kajasumanie”, “Chavakachcheri hindu college”);

--

--

No responses yet