What are the Difference between abstract class and interface in c# ASP.net?

Here Let us see What are the Difference between abstract class and interface in c# ASP.net? An abstract class without any implementation looks like an interface, but there are many differences than similarities between an abstract class and an interface. Explain both concepts and compare their differences.

Abstract Class
1. abstract class is a special kind of class that cannot be instantiated.
2. An abstract method is created by specifying the abstract type modifier.
3. It can contain Concrete methods(methods with implementation) So in other words, Abstract class can contain methods with both implementation and without implementation
4. Multiple inheritance is not possible in case of abstract class
5. Access specifiers are been Supported in abstract class
6. An abstract class can contain fields
7. An abstract class can implement code with non-Abstract methods.
8. An abstract class can have constructors or destructor’s
9. A class may inherit only one abstract class.

Interface
1. Interfaces cannot be instantiated directly.
2. An Interface cannot implement methods.
3. Multiple Inheritance is possible with interface
4. Access specifiers are not supported in Interface
5. An Interface cannot contain fields.
6. An Interface can be inherited from by structures.
7. A class may inherit several interfaces.


Leave a Reply

Your email address will not be published. Required fields are marked *