Friday, June 26, 2009

Abstract Classes

An abstract class is a class in which one or more methods are declared, but not defined. The bodies of these methods are omitted, because implementing the methods does not make sense. Since they have no definition and cannot be executed, they are called abstract methods. The declaration for an abstract method ends with a semicolon and you specify the method with the keyword abstract to identify it as such. To declare that a class is abstract you just use the keyword abstract in front of the class keyword in the first line of the class definition.

To demonstrate the use of abstract classes I modified the last example. Click here to download the code.

No comments:

Post a Comment