Introduction
In this article, I am going to explain the difference between an Abstract Class and an Interface in C# with some code examples.
Abstract class vs interface
- An abstract class doesn't provide full abstraction but an interface does provide full abstraction; i.e. both a declaration and a definition is given in an abstract class but not so in an interface.
- Using abstract we cannot achieve multiple inheritance but using an Interface we can achieve multiple inheritance.
- We can not declare a member field in an Interface.
- We can not use any access modifier i.e. public, private, protected, internal etc., because within an interface by default everything is public.
- An Interface member cannot be defined using the keyword static, virtual, abstract or sealed.
Abstract Class
We can not create an object of an abstract class and can call the method of abstract class with the help of class name only.
Take a look at an Abstract class example,

The code window looks like this,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
abstract class M1
{
public int add(int a, int b)
{
return (a + b);
}
}
class M2 :M1
{
public int mul(int a, int b)
{
return a * b;
}
}
class test
{
static void Main(string[] args)
{
M2 ob = new M2();
int result = ob.add(10, 20);
Console.WriteLine("the result is {0}", result);
Console.ReadLine();
}
}
}
When we run it the output looks like this,

An Interface
The syntax of an Interface looks like this,
interface
{
//Interface member
}
Note
- An Interface member cannot contain code bodies.
- Type definition members are forbidden.
- Properties are defined in an interface with the help of an access block get and set, which are permitted for the property.
interface myInterface
{
int myint
{
get;
set;
}
}
Take a look in an interface example,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
interface MyInterface
{
void myMethod();
}
class MyClass : MyInterface
{
public static void Main()
{
MyClass cls = new MyClass();
cls.myMethod();
}
public void myMethod()
{
Console.WriteLine("welcome to MCN IT SOLUTION");
Console.ReadLine();
}
}
}
After running this program we obtain the output as follows,

Note: In C#, an Interface provides only those public services declared in the interface, whereas an abstract class provides the public services defined in an abstract class and those members that are inherited from the abstract class's base class.

Harsh Pratap SinghPosted Feb 25, 2025, 6:33 PM
Can you please update this article? I got confused during the interview process as we look for main points and when I started with details implementation with considering some of the points working and then I started looking the Microsoft official document.
Dinesh KumarPosted Feb 18, 2022, 6:23 AM
Nice article.
Mohammed AbdalhakamPosted Feb 5, 2022, 9:03 PM
Since C# 8, many things changed for interfaces: you may have default method implementation, access modifiers (like public, private ..etc), you can define field if it's static. the following is correct definition in C# 8: interface ICar { private void Drive() { //default implementation! } public static int millage; }
Javed AlamPosted Nov 24, 2018, 7:08 AM
We know we can not create the object of abstract class so how can we access the method of abstract class using class name. What you trying to explain. also we can not use static keyword with abstract.
Sudheshwer RaiPosted Oct 11, 2018, 7:17 AM
A) Abstract Class: We can not create an object of an abstract class and can call the method of abstract class with the help of class name only. I think it's not correct. Would you please confirm ?
Bhavesh JadavPosted Oct 9, 2018, 12:13 AM
Nice............
Shashi GowdaPosted Sep 28, 2018, 11:10 AM
There is nothing like multiple inheritance in object oriented world. In real world an object always has one parent and cant be created from multiple parents. You are going to implement and use multiple contracts/set of behaviors in the case of multiple interface
Siraj AhmadPosted Aug 14, 2018, 9:20 PM
Nice, but little bit more in example of interface
Ramesh PalaniappanPosted Sep 7, 2016, 11:56 AM
Good one
FAROOKH MANSURIPosted Mar 7, 2016, 2:07 AM
Nice one.....
Ajeet MishraPosted Feb 26, 2016, 7:18 AM
NICE
Upendra Pratap ShahiPosted Sep 19, 2015, 5:49 AM
nice ..
Nitin AggarwalPosted Mar 19, 2015, 6:06 PM
Remove abstract from first example and result is same, i agree with Georgie
Manish SharmaPosted Mar 9, 2013, 5:30 AM
thanks Asif ..
Asif KhanPosted Mar 9, 2013, 3:34 AM
nice article
Manish SharmaPosted Oct 29, 2012, 10:08 AM
Thanks kishna
Manish SharmaPosted Sep 27, 2012, 9:23 AM
Thanks anil ..
Anil Kumar YadavPosted Jul 4, 2012, 7:31 AM
good article..thanks
Kishna JaiswalPosted May 31, 2012, 6:10 AM
nice information