REPORT zr_class_03.
*----------------------------------------------------------------------*
* CLASS lcl_car DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_car DEFINITION.
PUBLIC SECTION.
METHODS get_car EXPORTING ex_model TYPE string
ex_make TYPE string.
METHODS constructor IMPORTING im_model TYPE string
im_make TYPE string.
PRIVATE SECTION.
DATA: model TYPE string,
make TYPE string.
METHODS set_car IMPORTING im_model TYPE string
im_make TYPE string.
ENDCLASS. "lcl_car DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_car IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_car IMPLEMENTATION.
METHOD constructor.
me->set_car( EXPORTING im_model = im_model
im_make = im_make ).
ENDMETHOD. "constructor
METHOD get_car.
ex_model = me->model.
ex_make = make.
ENDMETHOD. "get_car
METHOD set_car.
me->model = im_model.
me->make = im_make.
ENDMETHOD. "set_car
ENDCLASS. "lcl_car IMPLEMENTATION
START-OF-SELECTION.
DATA: r_car TYPE REF TO lcl_car,
r_tab TYPE TABLE OF REF TO lcl_car,
gv_model TYPE string,
gv_make TYPE string.
CREATE OBJECT r_car
EXPORTING
im_model = 'SM7'
im_make = '2009'.
APPEND r_car TO r_tab.
CREATE OBJECT r_car
EXPORTING
im_model = 'SM5'
im_make = '2010'.
APPEND r_car TO r_tab.
LOOP AT r_tab INTO r_car.
r_car->get_car( IMPORTING ex_model = gv_model
ex_make = gv_make ).
WRITE:/ gv_model, gv_make.
ENDLOOP.