Abstract Classes

Abstract Class

Abstract Class is a class that can't be instantiated (objects cannot be created).

It's supposed to represent something abstract and not specific.

Let's look at the following example:



  • The abstract class Vehicle is defined at lines 1-12.
  • The name of the abstract class is Vehicle. This is something indefinite and it's inherited by other classes.
  • If we uncomment line 24 the code won't compile. That's due to the error set at line 9.