About classes

  • March 6, 2010
  • 0 Comments

In this post I will talk about classes and what you can do with them.

  • Abstract class

When you create a abstract class, you want to ensure that this class can not be instantiated. You wil have to create a sub-class that wil actually use the functionality.

Example:

abstract class MyClass
{
}
  • Extends

When you want to create a new class that inherits methods/properties from a other class, you can ‘extend’ the class. A typical example of a class you will extend from is the ‘RunBaseBatch’-class. When you do this, you will automatically be able to schedule your class.

Example:

class MyClass extends RunBaseBatch
{
}
  • Implements / Interface

Sometimes you want to create a blue-print for new classes by creating a ‘Interface’ class. The you just need to ‘Implement’ the blueprint in you’re new class.

Example:

class MyClass implements SysComparable
{
}