ABAP Keyword Documentation → ABAP - Reference → Declarative statemnts → Classes and Interfaces → ABAP Objects - Overview → Inheritance
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
addition of the
in order to adjust them to the requested specialization. The interface of a redefined method cannot be changed. The method is merely reimplemented under the same name. Constructors cannot be redefined; instead,
special rules apply.
The method declaration remains with the superclass, and its previous implementation is also persisted there. The implementation of the redefinition is generated additionally with the subclass and obscures the implementation of the superclass. A redefined method works with the private attributes of the subclass and not with possible private superclass attributes of 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
me. For example, if a superclass method
m1 contains a call [me->]m2(
CALL METHOD [me->]m2 and if
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
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 obscured method, for example to adopt and supplement its functions.