TYPES type.
... TYPE REF TO cif
The data type type is declared as a
reference in ABAP Objects. cif is either a
class or an interface. References are used to type reference variables which, in turn, contain references (pointers) to
objects.
References that refer to a class are called class references.
Likewise, references that refer to an interface are called interface references. Reference variables
which are typed using class references can contain object references to objects of that class. Reference
variables which are typed using interface references can contain object references to objects whose class implements the interface.
Objects, that is, instances of classes are only addressed using reference variables. For creating objects,
see CREATE OBJECT.
INTERFACE I1.
METHODS M1.
ENDINTERFACE.
CLASS C1 DEFINITION.
PUBLIC SECTION.
INTERFACES I1.
ENDCLASS.
TYPES: T_C1 TYPE REF TO C1,
T_I1 TYPE REF TO I1.
DATA: O1 TYPE T_C1,
O2 LIKE O1,
IR TYPE T_I1.
CREATE OBJECT O1.
O2 = O1.
IR = O1.
CLASS C1 IMPLEMENTATION.
METHOD I1~M1.
...
ENDMETHOD.
ENDCLASS.
Handling Objects
ALIASES | Declaration of an alias name |
CALL METHOD | Call of a method |
CLASS ... ENDCLASS | Definition of a class |
CLASS-DATA | Declaration of a static attribute |
CLASS-EVENTS | Declaration of a static event |
CLASS-METHODS | Declaration of a static method |
CREATE OBJECT | Creation of an object |
EVENTS | Declaration of an instance event |
INTERFACE ... ENDINTERFACE | Definition of an interface |
INTERFACES | Including an interface |
METHOD ... ENDMETHOD | Definition of a method |
METHODS | Declaration of an Instance method |
PRIVATE SECTION | Start of private visibility section |
PROTECTED SECTION | Start of a protected visibility section |
PUBLIC SECTION | Start of the public visibility section |
RAISE EVENT | Triggering an event |
SET HANDLER | Registering an event |