First page Back Continue Last page Graphics
Interfaces vs. Abstract Classes
Abstract classes are classes that cannot have instances; Interfaces are not even classes
The reason for using an abstract class is to force other programmers to create subclasses
The reasons for using an interface include:
- making classes more reusable
- simulating multiple inheritance
- taking advantage of pure polymorphism
Knowing how and when to use abstract classes and interfaces comes with experience