---
title: "What is a basic concept of Interface"  
description: "What is a basic concept of Interface"  
author: "Jonas Stuart"  
published: 2016-09-15  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/23041/what-is-a-basic-concept-of-interface  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# What is a basic concept of Interface

Interface is used in the C# for declaring the function etc, which can be implement, in the various class. It is similar to the base class which can be inherit into the derived but it is multilayered and class inherit concept is single layer hence it is more accessible.

## For Example-

```
using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace ConsoleApplication11{   
interface Interface1    {       
void SampleMethod();    }   
interface Interface2    {       
void SampleMethod2();    }    
class interfacedemo : Interface1, Interface2    {        
public void SampleMethod()       
{           
Console.WriteLine("Sample Method");       
}       
public void SampleMethod2()       
{           
Console.WriteLine("SampleMethod2");       
}       
static void Main()       
{           
interfacedemo obj = new interfacedemo();           
obj.SampleMethod();           
obj.SampleMethod2();           
Console.ReadLine();       
}    }}
```

## Answers

### Answer by Jonas Stuart

Interface is used in the C# for declaring the function etc, which can be implement, in the various class. It is similar to the base class which can be inherit into the derived but it is multilayered and class inherit concept is single layer hence it is more accessible.

## For Example-

```
using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace ConsoleApplication11{   
interface Interface1    {       
void SampleMethod();    }   
interface Interface2    {       
void SampleMethod2();    }    
class interfacedemo : Interface1, Interface2    {        
public void SampleMethod()       
{           
Console.WriteLine("Sample Method");       
}       
public void SampleMethod2()       
{           
Console.WriteLine("SampleMethod2");       
}       
static void Main()       
{           
interfacedemo obj = new interfacedemo();           
obj.SampleMethod();           
obj.SampleMethod2();           
Console.ReadLine();       
}    }}
```


---

Original Source: https://www.mindstick.com/interview/23041/what-is-a-basic-concept-of-interface

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
