REPORT Z_OO_11.
class vehicle DEFINITION.
public section.
events : myevent EXPORTING value(pl) TYPE i.
methods: speed.
ENDCLASS.
class vehicle IMPLEMENTATION.
method speed.
raise event myevent EXPORTING pl = 2.
ENDMETHOD.
ENDCLASS.
class handler definition.
public section.
methods handler_event for event myevent of vehicle IMPORTING pl.
ENDCLASS.
CLASS handler IMPLEMENTATION.
method handler_event.
WRITE:/ 'Speed can not be too fast. The speed is ',pl
LEFT-JUSTIFIED.
ENDMETHOD.
ENDCLASS.
start-OF-SELECTION.
data inst_vehicle type ref to vehicle.
data inst_vehicle2 type ref to vehicle.
data inst_handle type ref to handler.
create object : inst_vehicle,inst_vehicle2,inst_handle.
set HANDLER inst_handle->handler_event for inst_vehicle.
"call method inst_vehicle2->speed.
call method inst_vehicle->speed. |