CLASS parent DEFINITION.
PUBLIC SECTION.DATA test TYPE char50.
METHODS gv_pub.
PROTECTED SECTION.
DATA gv_date TYPE sy-datum.
METHODS gv_pro.
ENDCLASS.
CLASS parent IMPLEMENTATION.
METHOD gv_pub.
test = 'Method declared in Public of Parent Class'.
WRITE / test.
CALL METHOD gv_pro.
ENDMETHOD.
METHOD gv_pro.
gv_date = sy-datum.
WRITE: / 'Today is = ', gv_date DD/MM/YYYY.
SKIP 2.
ENDMETHOD.
ENDCLASS.
CLASS child DEFINITION INHERITING FROM parent.
PUBLIC SECTION.
DATA c_txt TYPE char50.
methods gv_pub redefinition.
PROTECTED SECTION.
DATA time TYPE sy-uzeit.
METHODS gv_pro REDEFINITION.
ENDCLASS.
CLASS child IMPLEMENTATION.
METHOD gv_pub.
c_txt = 'Method Redefined in Public of Child Class'.
WRITE / c_txt.
CALL METHOD gv_pro.
ENDMETHOD.
METHOD gv_pro.
time = sy-uzeit.
WRITE: / 'Now the Time is = ', time.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA: obj_par TYPE REF TO parent,
obj_chi TYPE REF TO child.
CREATE OBJECT: obj_par, obj_chi.
CALL METHOD: obj_par->gv_pub,
obj_chi->gv_pub.
Serkan AKKAVAK
Computer Engineer BSc
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments