Ansicht
Dokumentation

ABENINHERITANCE_REDEFINITION - INHERITANCE REDEFINITION

ABENINHERITANCE_REDEFINITION - INHERITANCE REDEFINITION

Fill RESBD Structure from EBP Component Structure   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

- Redefining Methods

Each subclass contains the components of all classes that are located between this class and the root node in the inheritance tree. The visibility of a component is always the same and cannot be changed. However, it is possible to redefine the public and protected instance methods of all preceding superclasses using the addition REDEFINITION of the statement METHODS, to adapt them to the required level of specialization. The interface of a redefined method cannot be changed. The method is merely reimplemented with the same name. Constructors cannot be redefined and special rules apply.

The method declaration remains in the superclass, and its previous implementation is also retained there. The implementation of the redefinition is also generated for the subclass and hides the implementation of the superclass. A redefined method works with the private attributes of the subclass and not with any private superclass attributes with the same name.

Each reference that points to a subclass object uses the redefined method, even if it was typed with reference to a superclass. In particular, this also applies to the self-reference me. For example, if a superclass method m1 contains a call $[me->$]m2( ) and if m2 is redefined in a subclass, the call of m1 in an instance of the superclass causes the original method m2 to be executed and the call of m1 in an instance of the subclass causes the redefined method m2 to be executed.

Within a redefined method, super->meth can be used to access the hidden method, for example, to adapt and supplement its functions.






Addresses (Business Address Services)   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 2127 Date: 20240329 Time: 112437     sap01-206 ( 52 ms )