---
title: "Abstract and Interface in c#"  
description: "Abstract-An Abstract Class can have non-abstract method (Concrete Method) and abstract method .It Allows Access Specifier .We cannot make instance of"  
author: "Elena Glibart"  
published: 2017-01-17  
updated: 2018-03-17  
canonical: https://www.mindstick.com/blog/11265/abstract-and-interface-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Abstract and Interface in c#

Abstract-An Abstract Class can have non-[abstract method](https://www.mindstick.com/articles/23305/abstract-methods-and-class-in-c-sharp) (Concrete Method) and abstract method .It Allows Access Specifier .We cannot make instance of abstract Class. If we have to access the method of abstract class then we have to make child class and then we have to inherit the abstract class then by making the instance of child class we can access. We use abstract keyword for declaring Abstract Class.\

```
using System;using
System.Collections.Generic;using System.Linq;using System.Text;using
System.Threading.Tasks; namespace ConsoleApplication1{    class Program    {        static void Main(string[] args)        {            child ch = new child();            ch.Describe();            ch.getClassName();                  }    }     abstract class parent    {        public virtual void Describe()        {            Console.WriteLine("Hello
Mindstick!");            Console.ReadKey();        }        public abstract void
getClassName();        //it shows error when we compine abstract
body can not be define        //public abstract void getClassName()        //{        //   
Console.WriteLine("manish");        //}           }     class child : parent    {         public override void getClassName()        {            Console.WriteLine("aditya
kumar");            Console.ReadKey();        }    }}
```

\

![Abstract and Interface in c#](https://www.mindstick.com/blogs/bb7e137e-f770-49c5-b9dd-b50b70fa0cd9/images/fb78c981-07a2-4af6-b297-897b46cf53bc.png)\

\

**Interface-** Interface contain only declaration of method, Properties, But it cannot contain its implementation part. The responsibility of implementation is of child class. Interface does not contain any specifier. Interface does not contain any constructor if we make any constructor it shows error.We use interface keyword for declaring interface

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using
System.Threading.Tasks; namespace ConsoleApplication1{    class Program    {        static void Main(string[] args)        {            child ch = new child();            ch.Describe();                             }    }     interface  parent    {       void Describe();                   }    public class child:parent    {       public void Describe()        {            Console.WriteLine("hello");            Console.ReadKey();        }             }}
```

\

\

![Abstract and Interface in c#](https://www.mindstick.com/blogs/bb7e137e-f770-49c5-b9dd-b50b70fa0cd9/images/479d40a1-9ae6-4fe1-95f4-8cbd265b5191.png)\

\

**[Difference between Abstract](https://www.mindstick.com/forum/33880/difference-between-abstract-class-and-sealed-class) and Interface**

Interface 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) but abstract cannot support multiple [inheritance in c#](https://www.mindstick.com/articles/12037/inheritance-in-c-sharp).

In Interface we cannot declare its body part but abstract class can contain its body part means [implementation](https://www.mindstick.com/forum/33764/how-to-implementation-of-class-in-c-sharp) part.

We can make instance of abstract class but we cannot make instance of interface

**You can also visit these related articles & blogs**

[**Abstraction in c# with example**](https://www.mindstick.com/blog/319/abstraction-in-c-sharp-with-example)

[**Interface in c#**](https://www.mindstick.com/Articles/12036/c-sharp/interface-in-c-sharp)

[**Abstract class in c#**](https://www.mindstick.com/blog/501/abstract-class-in-c-sharp)

[**Difference Between interface vs Abstract class in c#**](https://www.mindstick.com/Articles/11956/difference-between-interface-vs-abstract-class-in-c-sharp)

---

Original Source: https://www.mindstick.com/blog/11265/abstract-and-interface-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
