Introduction
Nowadays, in an interview, no one asks direct questions; rather, they will give you a scenario and ask the solution for the same. And almost always there is one common question that you encounter in almost all interviews: "Where will you use Interface and Abstract class?" The interviewer will give one scenario and ask in this scenario if you will go for Abstract class or Interface and why.
My idea is to give readers an understanding of where to use Interface and Abstract classes but also to give an understanding in detail as well. Because both the concepts are very important.
Abstract Class in C#
The purpose of an abstract class is to provide the default functionality for its base class. You need to put the abstract keyword ahead of class to define it as an Abstract Class, as mentioned below,
publicabstractclassAbstractCar
{
}
You can have both abstract and non-abstract methods in the Abstract Class. Generally, we use the abstract class as a base class. But you need to implement all the abstract methods in the derived class by using the override keyword. You can’t create an object of Abstract Class. An abstract class can never support multiple inheritances.
Example

Now we move on and see a few important things about “Abstract Class,” let’s take it one by one.
- We will try to create an object of Abstract Class and see what happens.

So that means we can’t create an object of Abstract Class. - Interface will not provide any access specifier to the abstract method.

It means in the abstract class, abstract methods are not public by default; it's private by default. The access modifier of the abstract method should be the same in both the abstract class and in its derived class. If you declare an abstract method as protected, it should be protected in its derived class. Otherwise, the compiler will raise an error. - Like interface will not provide any access specifier to the abstract method.

We can define Delegates, Properties, etc. in Abstract Class. - Abstract Properties


- You need to implement all the abstract methods in a derived class,

I got the above error because I have not implemented all the methods in the derived class. So it’s mandatory to implement all the abstract methods and properties in the derived class.
Conclusion
I hope this article helps you to explore all the possibilities of Abstract Class. In case not, please drop me a note, and I will explore it further. In the second article, I will talk about Interface and will give more focus on where to use it.

DeepanPosted Nov 22, 2016, 2:03 PM
Easy to understand the basics of abstract class
Mohammad KhalidPosted Jul 14, 2016, 3:48 AM
Hi Nishant, Can you please make point number 2 more clear to understand. I think that point need more attention.
SubashPosted Jul 4, 2016, 8:41 AM
Thanks to Give the clear view of abstract Class
Nishant MittalPosted Jul 4, 2016, 12:37 AM
Thanks all
kalu singh raoPosted Jul 1, 2016, 2:01 AM
Nice...
Rahul Pushpendu BhaskarPosted Jun 30, 2016, 9:00 AM
Good...!
Biplab BiswasPosted Jun 24, 2016, 8:35 AM
Nice Article.
Humayun Kabir MamunPosted Jun 18, 2016, 11:45 AM
Nice...
RajaPosted Jun 15, 2016, 6:59 AM
Good One..
Asad AliPosted Jun 9, 2016, 8:59 AM
Good one
soundappan arumugamPosted Jun 6, 2016, 12:24 AM
good
Ravi SPosted Jun 5, 2016, 4:25 AM
Nice Article
Nishant MittalPosted Jun 5, 2016, 2:48 AM
Thanks for the input guys ...will share all the required details in the next artical ..asap...
Rahul Pratap SinghPosted Jun 4, 2016, 1:43 PM
you shared nice technical details of abstract class however you should also share some conceptual details of same.
Ivan GalabovPosted Jun 4, 2016, 4:54 AM
if you need to make changes to interface once released , think again what will happen if MS make changes to IEnumerable<T>. So in general if you need to extend some interface functionality do use abstract class . Never touch interface :)
Asutosha SarangiPosted Jun 3, 2016, 4:14 PM
if you can explain a scenario where to use and why use will appreciate
Ahmed Abd EllatifPosted Jun 3, 2016, 2:50 PM
Nice Article Thanks
Anil Kumar MurmuPosted Jun 3, 2016, 1:30 PM
Awaiting for the next article about interface
Syed Talha ShamimPosted Jun 3, 2016, 11:11 AM
nice
Vignesh ManiPosted Jun 3, 2016, 9:32 AM
NIce
Nishant MittalPosted Jun 3, 2016, 2:37 AM
Thanks for reading
sameer shaikhPosted Jun 3, 2016, 2:31 AM
thanks, your article is very helpful to me