*----------------------------------------------------------------------** CLASS superclass DEFINITION 定义基类*----------------------------------------------------------------------***----------------------------------------------------------------------*CLASS superclass DEFINITION. PUBLIC SECTION. DATA:para(30) TYPE c VALUE 'The Super method'. METHODS write_first.ENDCLASS. "superclass DEFINITION*----------------------------------------------------------------------** CLASS subclass DEFINITION 定义派生类*----------------------------------------------------------------------***----------------------------------------------------------------------*CLASS subclass DEFINITION INHERITING FROM superclass. PUBLIC SECTION. METHODS write_first REDEFINITION. "定义重载方法 METHODS write_second.ENDCLASS. "subclass DEFINITION*----------------------------------------------------------------------** CLASS superclass IMPLEMENTATION*----------------------------------------------------------------------***----------------------------------------------------------------------*CLASS superclass IMPLEMENTATION. METHOD write_first. WRITE: / para. ENDMETHOD. "write_firstENDCLASS. "superclass IMPLEMENTATION*----------------------------------------------------------------------** CLASS subclass IMPLEMENTATION*----------------------------------------------------------------------***----------------------------------------------------------------------*CLASS subclass IMPLEMENTATION. METHOD write_first. CALL METHOD super->write_first."调用基类的方法 ENDMETHOD. "write_first METHOD write_second. para = 'The Redefinition method'. CALL METHOD me->write_first."调用本身类的方法 ENDMETHOD. "write_secondENDCLASS. "subclass IMPLEMENTATIONDATA:inher_obj TYPE REF TO subclass.START-OF-SELECTION. CREATE OBJECT inher_obj. CALL METHOD:inher_obj->write_first,"调用派生类的重载方法 inher_obj->write_second.