February 28, 2008 at 7:44 PM
When to Use Interfaces
Two Important Differences Between Interfaces and Abstract Classes
* Interfaces provide a form of multiple inheritance. A class can extend only one other class.
* Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.
Interface or Abstract Class
* These two differences usually direct the choice.
* If multiple inheritance is important or even useful interfaces are used.
* Abstract class lets you define some or all of the implementation.
* Any major class you expect to be extended should be an implementation of an interface.