Sample code to show method over riding in local class in case of instance , static and instance method which is declared final.
*&---------------------------------------------------------------------*
*& Report ZOOABAP_CL16
*& Method Overriding (Local Classes)
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZOOABAP_CL16.
CLASS ZLCL_ABC DEFINITION.
PUBLIC SECTION.
METHODS M1. "instance method
METHODS M2 FINAL. "Declared final cannot be inherited
CLASS-METHODS m3 . "static metho
ENDCLASS.
CLASS ZLCL_ABC IMPLEMENTATION.
METHOD M1.
WRITE :/ 'Inside the instance method m1 of super class zlcl_abc...'.
ENDMETHOD.
METHOD m2.
WRITE : / 'Inside the instance method m2 final of super class zlcl_abc...so it cannot be redefined in sub class'.
ENDMETHOD.
METHOD m3.
WRITE : / 'Inside the static method m3 of super class zlcl_abc.....so it cannot be redefined in sub class'.
ENDMETHOD.
ENDCLASS.
CLASS zlcl_xyz DEFINITION INHERITING FROM zlcl_abc.
PUBLIC SECTION.
METHODS M1 REDEFINITION.
* METHODS M2." REDEFINITION. "error m2 cannot be re-defined as it's final method
* CLASS-METHODS M3 REDEFINITION. "error you can redefine static method
ENDCLASS.
CLASS zlcl_xyz IMPLEMENTATION.
METHOD m1.
call METHOD super->m1( ). "calling the super class methods (not mandatory)
WRITE : / 'Inside the instance method m1 of sub class zlcl_xyz ...'.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA OB TYPE REF TO ZLCL_XYZ .
CREATE OBJECT OB.
CALL METHOD OB->M1( ).
CALL METHOD OB->M2( ).
CALL METHOD OB->M3( ).
Output :