fINAL METHODS CANNOT BE REDEFINED.
CLASS class1 DEFINITION.
PUBLIC SECTION.
data: pernr type pernr-pernr.
methods: method1 final.
endclass.
class class1 implementation.
method method1.
pernr = '00010001'.
write:/ 'Pernr is :', pernr , '(Final Method)'.
endmethod.
endclass.
class class2 definition INHERITING FROM class1.
PUBLIC SECTION.
methods method1 REDEFINITION.
endclass.
class class2 implementation.
endclass.
start-of-selection.
data: obj1 type ref to class1,
obj2 type ref to class2.
create object : obj1, obj2.
call method: obj1->method1,
obj2->method1.
ERROR:
CODE:
************************************************************************
*& PROJECT :
*& Object Name :
*& Object Type :
*& Date Of Creation :
*& Functional Owner :
*& Functional Spec No. :
*& Developer :
*& Technical Spec No. :
*& Description :
*&
*&
*&
*& Functional Area :
*& Transport Request :
*& Development Class :
*& Transaction Code :
***********************************************************************
*& Modification History
***********************************************************************
*& Date Request No. Changed by Description Of Changes
*& --------- ------------ ----------- ----------------------
*&
*&
***********************************************************************
REPORT YRAMYA_OOPS_FINAL_METHODS.
CLASS class1 DEFINITION.
PUBLIC SECTION.
data: pernr type pernr-pernr.
methods: method1 final.
endclass.
class class1 implementation.
method method1.
pernr = '00010001'.
write:/ 'Pernr is :', pernr , '(Final Method)'.
endmethod.
endclass.
class class2 definition INHERITING FROM class1.
* PUBLIC SECTION.
* methods method1 REDEFINITION.
endclass.
class class2 implementation.
endclass.
start-of-selection.
data: obj1 type ref to class1,
obj2 type ref to class2.
create object : obj1, obj2.
call method: obj1->method1,
obj2->method1.
CLASS class1 DEFINITION.
PUBLIC SECTION.
data: pernr type pernr-pernr.
methods: method1 final.
endclass.
class class1 implementation.
method method1.
pernr = '00010001'.
write:/ 'Pernr is :', pernr , '(Final Method)'.
endmethod.
endclass.
class class2 definition INHERITING FROM class1.
PUBLIC SECTION.
methods method1 REDEFINITION.
endclass.
class class2 implementation.
endclass.
start-of-selection.
data: obj1 type ref to class1,
obj2 type ref to class2.
create object : obj1, obj2.
call method: obj1->method1,
obj2->method1.
ERROR:
CODE:
************************************************************************
*& PROJECT :
*& Object Name :
*& Object Type :
*& Date Of Creation :
*& Functional Owner :
*& Functional Spec No. :
*& Developer :
*& Technical Spec No. :
*& Description :
*&
*&
*&
*& Functional Area :
*& Transport Request :
*& Development Class :
*& Transaction Code :
***********************************************************************
*& Modification History
***********************************************************************
*& Date Request No. Changed by Description Of Changes
*& --------- ------------ ----------- ----------------------
*&
*&
***********************************************************************
REPORT YRAMYA_OOPS_FINAL_METHODS.
CLASS class1 DEFINITION.
PUBLIC SECTION.
data: pernr type pernr-pernr.
methods: method1 final.
endclass.
class class1 implementation.
method method1.
pernr = '00010001'.
write:/ 'Pernr is :', pernr , '(Final Method)'.
endmethod.
endclass.
class class2 definition INHERITING FROM class1.
* PUBLIC SECTION.
* methods method1 REDEFINITION.
endclass.
class class2 implementation.
endclass.
start-of-selection.
data: obj1 type ref to class1,
obj2 type ref to class2.
create object : obj1, obj2.
call method: obj1->method1,
obj2->method1.
No comments:
Post a Comment