ARTICLE
Inheritance Events
The example demonstrates the behavior of
inheritance events .
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
In a c1 superclass, a static event ce1 and an instance
event ie1 are declared. The superclass c1 , and its
subclass c2 , and its subclass c3 , each contain a static
method and an instance method to trigger events.
In the c4 class, event handlers are declared in c2 for the
events inherited from c1 . The main method of the
event_demo class registers events and calls all methods which can
trigger events, whereby different possibilities are used to address the
methods. The output displays an "X" after the method call for a handled
event.
The event handler cm4 , declared for the c2 class, can only
handle events which are triggered in this class or in its subclasses.
Events which are triggered by the static method cm1 in c1 ,
are not handled, irrelevant of the class name which is specified for the
call (also refer to Inheritance and Static
Components ).
The event handler im4 , declared for the c2 class, can also
only handle events which are triggered in this class or in its
subclasses. Unlike when calling static methods, the class of the object
is always addressed when addressing an object using an object reference,
and triggered events in the inherited method im1 of the c2
and c3 classes are handled.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved