REPORT zdemo016.
*----------------------------------------------------------------------*
* CLASS class DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class DEFINITION.
PUBLIC SECTION.
DATA:gv_a TYPE c.
METHODS constructor.
METHODS write IMPORTING iv_a TYPE i.
PROTECTED SECTION.
PRIVATE SECTION.
DATA:gv_b TYPE c.
ENDCLASS. "class DEFINITION
*----------------------------------------------------------------------*
* CLASS class IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS class IMPLEMENTATION.
METHOD constructor.
WRITE 'constructor'.
WRITE gv_a.
ENDMETHOD. "constructor "read
METHOD write.
gv_a = gv_a + 1.
WRITE gv_a.
ENDMETHOD. "write
ENDCLASS. "class IMPLEMENTATION
DATA:gcl_class1 TYPE REF TO class.
DATA:gcl_class2 TYPE REF TO class.
START-OF-SELECTION.
CREATE OBJECT gcl_class1.
CREATE OBJECT gcl_class2.
CALL METHOD gcl_class1->write( 1 ).
CALL METHOD gcl_class1->write( 1 ).
CALL METHOD gcl_class2->write( 1 ).
CALL METHOD gcl_class2->write( 1 ).
阅读(6370) | 评论(0) | 转发(0) |