Thursday, July 9, 2009

Difference between interface and abstract classes in C#?

An abstract class is a special type of class that cannot be instantiated. To use it, you must create another class that inherits from your abstract class.





An interface only contains method signatures, not implementations. It is basically a contract. Any class that implements an interface must implement the methods contained in that interface.





As a side note, a C# class can implement multiple interfaces but it can only inherit one abstract class.


No comments:

Post a Comment