Ansicht
Dokumentation
ABAPMETHODS_ABSTRACT_FINAL - METHODS ABSTRACT FINAL
ROGBILLS - Synchronize billing plans BAL_S_LOG - Application Log: Log header dataThis documentation is copyright by SAP AG.
METHODS, ABSTRACT, FINAL
METHODS meth ... ABSTRACT$|FINAL ...
Additions
Effect
The additions ABSTRACT and FINAL make an instance method abstract or final. They cannot
be used in interfaces, only in classes. All instance methods can be declared as abstract except for instance constructors. The addition FINAL can be used in all variants of the statement METHODS.
Addition 1
... ABSTRACT
Effect
The addition ABSTRACT defines an abstract method meth. The addition ABSTRACT is
allowed only in abstract classes, not in interfaces. An abstract method is not implemented in the implementation part of its class. To implement an abstract method, it must be redefined in a
specific subclass
using the addition REDEFINITION. Private methods cannot be redefined and can therefore not be declared as abstract.
Notes
- Abstract methods can also be defined in classes that are both abstract and final, but they can never be implemented and therefore are not usable.
- Methods in interfaces are always implicitly abstract, because interfaces do not contain method implementations.
- With the exception of the instance constructor, concrete instance methods of a class can also call their abstract methods.
- Static methods cannot be redefined, and the addition ABSTRACT is not allowed in their declarations.
Declaration of an abstract method of an abstract superclass and its implementation in a concrete subclass.
Addition 2
... FINAL
Effect
The addition FINAL defines a final method meth. The addition FINAL is allowed only in classes, not in interfaces. A final method cannot be redefined in a subclass. In final classes, all methods are automatically final and the addition FINAL is not allowed. An instance constructor constructor is always final and FINAL can be specified but is not mandatory.
Notes
- Static methods cannot be redefined, and the addition FINAL is not allowed in their declarations.
- The addition FINAL closes a path of an inheritance tree with regards to the possibility to redefine the method.
Example
The final method get_the_truth of a superclass returns a value, which cannot be changed in a subclass. Method get_opinion can be redefined in a subclass, but the subclass shown here prevents the method from being redefined in subclasses.
Vendor Master (General Section) ABAP Short Reference
This documentation is copyright by SAP AG.
Length: 3628 Date: 20240425 Time: 223812 sap01-206 ( 67 ms )