What is an interface?
- Last Updated: December 18, 2019
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
An interface is an ABL class used to define
PUBLIC data members and methods
that must be implemented by other classes. The interface class
does not provide any code, but simply the names and parameters
for methods that must be implemented. An interface enforces
coding standards for classes that implement the interface.
Classes that implement an interface must define and provide code
for all data members and methods defined in the interface class,
with identical names, parameters, and return types. Multiple
classes can implement the same interface, which ensures that
they all behave in the same way.
For example, an interface class, ICustomerInvoice, could define the
required methods related to customer billing functionality such
as a method named SendInvoice().
Two classes would be defined to implement the ICustomerInvoice interface.
A RetailCustomerInvoice class
would implement its version of SendInvoice(), which would send an invoice
to a customer at home. The EnterpriseCustomerInvoice class would
implement its version of SendInvoice(), which would send an invoice
to a business using a purchase order (PO) number.