Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Classes and Interfaces →  ABAP Objects - Overview →  Inheritance 

Inheritance and Interfaces

Interfaces are standalone constructs in ABAP Objects that support polymorphism of classes. The polymorphism of interfaces is based on the fact that each class implementing an interface can implement the methods of that interface differently. To the outside world, all interface components look similar which is why interface reference variables can point to objects of all classes that implement the associated interface.

The interface concept exists independently of and in addition to the inheritance concept.The classes of an inheritance tree can implement any number of interfaces but each interface can be implemented only once in each inheritance tree. This ensures that each interface component comp has a unique name in the entire inheritance tree intf~icomp and that, starting with the class that implements it, it is contained in all subclasses. Interface reference variables that can point to a class of the inheritance tree can also point to all subclasses. Once implemented, interface methods are fully functioning components of a class and can be redefined in subclasses. In the case of interface methods defined as optional using DEFAULT (and without explicit implementation), the default behavior when called applies along a path of an inheritance tree until a redefinition with explicit implementation occurs.

Other versions: 7.31 | 7.40 | 7.54