Try OpenEdge Now
skip to main content
Object-oriented Programming
Getting Started with Classes, Interfaces, and Objects : Using the INTERFACE construct : INTERFACE statement
 

INTERFACE statement

This is the syntax for defining an interface:

Syntax

INTERFACE interface-type-name :
  [ INHERITS super-interface-name[ , super-interface-name]...] :
  [{temp-table|ProDataSet}...]
  [property...]
  [method...]
  [event...]
END [ INTERFACE ] .
Element descriptions for this syntax diagram follow:
interface-type-name
The object type name for the interface definition is specified using the following syntax:
[ " ][package.]interface-name [ " ]
package
A period-separated list of string components that comprise a package name that, along with interface-name, uniquely identifies the interface among all accessible classes and interfaces in your application environment.
Note that you cannot specify Progress as the first component of the package name for any ABL user-defined interface. For example, Progress.Inventory is an invalid package name for a user-defined interface and results in a compiler error.
interface-name
The interface name, which must match the filename of the class file containing the interface definition.
For more information on this syntax, see Defining and referencing object type names.
For an interface definition, if the interface is defined in a package, you must specify package, even if the class definition file contains a USING statement that specifies the fully qualified object type name for the interface or its package. For more information, see Referencing an object type name without its package.
INHERITS super-interface-name[ , super-interface-name] ...
One or more interfaces that the definition for interface-type-name inherits. The property, method, and event prototypes defined by each super-interface-name thus become part of this interface definition, and multiple occurrences of the same super-interface-name or member prototype in the interface hierarchy are treated as a single occurrence. However, you can never specify interface-type-name as an inherited interface. In other words, there can be no cycle in an interface inheritance hierarchy (recursive inheritance). Otherwise, ABL raises a compile-time error.
The syntax for super-interface-name is the same as for interface-type-name. However, if a USING statement specifies a fully qualified super-interface-name or its package, you can specify the super interface using its unqualified interface name. For more information, see Referencing an object type name without its package. Based on this information, ABL locates each specified super interface definition file (either the source file or the r-code file) in order to compile and run with this user-defined interface.
For more information on using interface inheritance, see Interface hierarchies and inheritance.
temp-table | ProDataSet
A static temp-table or ProDataSet definition. The interface must supply temp-table and ProDataSet definitions for any temp-tables and ProDataSets used as parameters to methods defined for the interface. These are data definitions only. Such temp-table or ProDataSet definitions cannot specify the STATIC option. The class that implements this interface must define an instance data member that matches each data definition in the interface. These temp-table or ProDataSet definitions cannot be inherited from a super interface; they are private to and apply only to the members of the interface in which they are defined.
property
A property interface prototype. Each property prototype is declared by a single DEFINE PROPERTY statement, with one or both of the GET and SET accessors specified, but with no accessor implementations. This means that appropriate access mode and data type information is specified for each accessor, but the accessor code block must be empty. All interface properties must be defined as PUBLIC, either explicitly declared or by default. These property prototypes cannot specify the INITIAL, STATIC, ABSTRACT, or OVERRIDE options. A property prototype has no storage allocated for it to hold an initial value and it can only be implemented as an instance property.
The class that implements this interface must fully define a corresponding property that matches each property prototype in the interface. It must at least define the accessors specified in the interface prototype, but it can also define any accessor that is not specified in the prototype. For more information on defining properties, see Defining properties within a class.
method
A method interface prototype. Each method prototype is declared by a single METHOD statement with a signature, but with no implementation and no END METHOD statement. All interface methods must be defined as PUBLIC, either explicitly declared or by default. These method prototypes cannot specify the STATIC, ABSTRACT, or OVERRIDE options. A method prototype can only be implemented as an instance method. Method prototypes can be overloaded and can overload implemented method definitions. Note that interfaces cannot contain a constructor or destructor.
The class that implements this interface must fully define a corresponding method that matches each method prototype in the interface. For more information on defining methods, see Defining methods within a class.
event
A class event interface prototype. Each event prototype is declared by a single DEFINE EVENT statement with a signature. All interface events must be defined as PUBLIC, either explicitly declared or by default. These event prototypes cannot specify the STATIC, ABSTRACT, or OVERRIDE options. An event prototype can only be implemented as an instance event.
The class that implements this interface must fully define a corresponding event that matches each event prototype in the interface. Note that there is little difference between an interface event prototype and the event definition that implements it. However, as for any interface member, an event interface prototype ensures that a corresponding event member is defined in the class that implements the interface. Also note that while the syntax of the event implementation is no different from the interface event prototype, only the class definition that implements an event can publish the event to the application. For more information on defining events, see Defining events within a class.