Interface vs Base Class (.Net)
Interface is similar to a base class, it is also very different.
They are similar..
– Both provide structure to another class that uses them
– Both can be used for polymorphism
Interfaces are different than base classes ..
– A class can inherit only one base class, but it can implement many interfaces. (Very important)
– A base class can contain implementation, an interface cannot contain implementation
– Interfaces can only contain Methods, Properties, Indexers, and Events. They cannot contain fields or constants (which are used for implementation)
Leave a Reply