Define an interface class
- Last Updated: January 16, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
You create an interface class in Developer Studio by opening the New ABL Interface wizard from the directory where you want to
create the interface class file and then naming the interface class. Then, in the
editor, you add the PUBLIC data members and methods for the class.
PUBLIC data members can be temp-tables, datasets,
variables, or properties. You define them just as you would in a class definition.
You also need to define all the PUBLIC methods required
by the interface. You define the method’s return type, name, and parameter list just as
you would in a class definition, except that statement ends with a period after the
parameter list, rather than with a colon. There is no body or end method statement.
Here is an example. Suppose we used the New ABL Interface wizard to
create an interface class called IProduct in the
Inventory folder. We will use the IProduct
interface class as a template for each type of product in the inventory.
using Progress.Lang.*.
using Inventory.IProduct.
block-level on error undo, throw.
interface Inventory.IProduct:
end interface.Within the interface block, we would
then need to define the PUBLIC data members and methods required by the
interface.
Here is the interface block for the IProduct interface class with a data member and three methods defined.
using Progress.Lang.*.
using Inventory.IProduct.
using Inventory.Item.
block-level on error undo, throw.
interface Inventory.IProduct:
{include/Items.i}
method public void AddItem( input pItem as Item).
method public Item GetItem( input pItemCode as character ).
method public integer NumberItems().
end interface.
end method statements and end with a period instead of a colon.