Interfaces, which have long existed in OO languages such as C#, are also supported in ABL. An interface is an object type, like a class, that consists of one or more method, property, or event prototypes that a class must implement. That is, the methods, properties, and events defined in an interface are empty and do not contain any executable code. Any class that includes an interface in its definition must implement all the methods, properties, and events of that interface. Note that an ABL interface never defines prototypes for data members that a class must implement. However, it can include temp-table and ProDataSet definitions to specify parameters for method or event prototypes that define temp-tables and ProDataSets as parameters.
You define an ABL interface using the INTERFACE statement and define its members within the interface block terminated by the END INTERFACE statement. Like a class type, you can define an interface type in a package. Similarly, a .NET interface, like .NET class, can be defined in a namespace.
To implement one or more interfaces in a user-defined class, you specify them with the IMPLEMENTS option of the CLASS statement. By implementing an interface, you assure any other code (class or procedure) that uses your class that the methods, properties, and events defined by the interface have been implemented. You can use a class object reference defined as an interface to access the interface methods, properties, and events, even for object references of different class types, as long as the given class implements the specified interface.
Defining and implementing interfaces is useful when you want to build classes with a standard set of methods, properties, and events. The implementation of interfaces is validated at compile time.