REPORT zthomas_oo_pattern_singleton.
*----------------------------------------------------------------------*
* CLASS lcl_vehicle DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_vehicle DEFINITION.
PUBLIC SECTION.
METHODS:initial IMPORTING name TYPE string.
ENDCLASS. "lcl_vehicle DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_vehicle IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_vehicle IMPLEMENTATION.
METHOD initial.
WRITE:/ 'this is', name.
ENDMETHOD. "initial
ENDCLASS. "lcl_vehicle IMPLEMENTATION
DATA:lo_car TYPE REF TO lcl_vehicle.
START-OF-SELECTION.
*CREATE OBJECT lo_car.
IF lo_car IS NOT BOUND.
CREATE OBJECT lo_car.
ELSE.
MESSAGE 'you have created this object' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
CALL METHOD lo_car->initial
EXPORTING
name = 'truck'.
阅读(543) | 评论(0) | 转发(0) |