---
title: "Interface in C#"  
description: "An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or i"  
author: "Sumit Kesarwani"  
published: 2013-05-10  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/497/interface-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Interface in C#

An [interface](https://www.mindstick.com/articles/12101/interfaces-in-java-extending-interfaces) is not a class. It is an entity that is defined by the word Interface. An interface has no [implementation](https://www.mindstick.com/forum/33764/how-to-implementation-of-class-in-c-sharp); it only has the [signature](https://www.mindstick.com/interview/516/explain-about-xml-signature) or in other words, just the [definition](https://yourviews.mindstick.com/view/70598/false-furore-over-the-leadership-definition-statement-of-army-chief-bipin-rawat) of the methods without the body.\

##### Defining an Interface

##

```
interface interfaceName{}
```

##### Differences between Interfaces and Abstract classes

*An Interface cannot implement methods. \
*An [abstract class](https://www.mindstick.com/articles/1430/abstract-class) can implement methods. \
\
*An Interface can only inherit from another Interface. \
*An abstract class can inherit from a class and one or more [interfaces](https://www.mindstick.com/articles/12100/interfaces-in-java-real-life-example). \
\
*An Interface cannot contain fields. \
*An abstract class can contain fields. \
\
*An Interface can contain [property](https://www.mindstick.com/blog/205/property-notification-in-c-sharp) definitions. \
*An abstract class can implement a property. \
\
*An Interface cannot contain constructors or destructors. \
*An abstract class can contain constructors or destructors. \
\
*An Interface can be inherited from by structures. \
*An abstract class cannot be inherited from by structures. \
\
*An Interface can support [multiple inheritance](https://www.mindstick.com/forum/159471/how-does-c-plus-plus-support-multiple-inheritance-and-what-are-potential-issues-associated-with-it). \
*An abstract class cannot support multiple inheritance.

##### Example

```
using System; namespace InterfaceConsoleApplication{    class Program : myInterface //Implement the interface    {        static void Main(string[] args)        {            Program p1 = new Program();            p1.display(); //call the method        }        //Give funtionality to method who declared in interface        public void display()        {            Console.WriteLine("Interface Method");        }    }    //declare interface    interface myInterface    {        void display();    }}
```

##### Output :-

Interface Method

In this example, I have created a interface myInterface using interface keyword and define a method named display().Class Program inherits the myInterface and give full definition to method display() and call by the Program class object p1.

---

Original Source: https://www.mindstick.com/blog/497/interface-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
