An abstract class serves two related purposes:
- You can put abstract members in a class
- You cannot instantiate an abstract class
The main purpose of an abstract class is to serve as a base class for descendant classes, providing, perhaps, some common functions, but at least providing a common set of methods that descendants must execute.
For example, you can create an abstract Fruit class with an abstract Eat method. Since you cannot actually eat “fruits,” you need to eat a certain type of fruit, the class is abstract, and you will never see an object labeled “Fruits” in the wild.
Instead, you will see objects like Apple, Banana, Orange, etc., which are descendants of Fruit, and which have a real implementation of Eat.
Apart from the two things above, there is nothing special about an abstract class.
Lasse Vågsæther Karlsen May 17 '10 at 12:46
source share