ARTIClE
ABAP Objects, Inheritance
This example demonstrates the specialization of a counter using
inheritance.
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
The counter_ten class is derived from counter and
redefines the increment method. In counter , the visibility
of the attribute count must be changed from PRIVATE to
PROTECTED . In the redefined method, the nested method with the
pseudo reference super- is called. The redefined method
specializes the inherited method.
An object of the subclass is created, to which a reference variable of
the superclass type points. During the execution of the increment
method, the redefined method of the subclass is executed using the
superclass reference.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved