From cb1061b5d095a5bbeb16fe7120c020bf7c6189a1 Mon Sep 17 00:00:00 2001
From: Dan <16720986+danrega@users.noreply.github.com>
Date: Tue, 13 Dec 2022 12:37:41 +0100
Subject: [PATCH] Update 04_ABAP_Object_Orientation.md
---
04_ABAP_Object_Orientation.md | 39 ++++++++++++++++-------------------
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/04_ABAP_Object_Orientation.md b/04_ABAP_Object_Orientation.md
index c7d20b4..0205d54 100644
--- a/04_ABAP_Object_Orientation.md
+++ b/04_ABAP_Object_Orientation.md
@@ -89,7 +89,6 @@ classes
> **💡 Note**
-> - Regarding the names of global and local classes and usage of classes in ABAP programs when, for example, calling methods, the system searches for a local class with the specific name at first. Then, if a local class with that name is not found, the systems searches for a global class.
> - The class design must be done with care. If a class is only used in one program (or class), choosing a local class is enough. However, global
classes must be prepared to be used anywhere. A later change of that class, especially regarding the visibility of components (see
further down) or the data types of attributes that are used in other programs might cause problems.
@@ -213,7 +212,7 @@ kind of components are to be distinguished:
**Attributes**
-- The attributes of a class mean the data objects declared within a
+- The attributes of a class (or interace) mean the data objects declared within a
class (or interface).
- [Static
attributes](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenstatic_attribute_glosry.htm "Glossary Entry")
@@ -413,7 +412,7 @@ CLASS local_class DEFINITION.
"Formal parameter definitions
stat_meth3 IMPORTING VALUE(m) TYPE i "pass by value
REFERENCE(n) TYPE i "pass by reference
- o TYPE i, "same as n
+ o TYPE i, "same as n; the specification of REFERENCE(...) is optional
"OPTIONAL/DEFAULT additions
stat_meth4 IMPORTING p TYPE i DEFAULT 123
@@ -441,7 +440,7 @@ must be declared. Such an [object reference
variable](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abenobject_refer_variable_glosry.htm "Glossary Entry")
is also necessary for accessing objects and their components, i. e.
objects are not directly accessed but only via references that point to
-those objects. This reference is stored in the reference variables.
+those objects. This reference is stored in the reference variable.
``` abap
DATA: ref1 TYPE REF TO local_class,
ref2 TYPE REF TO global_class,
@@ -552,7 +551,7 @@ within the class in which it is declared, the static method can also be
called without `class_name=>...`. You might also see method
calls with [`CALL METHOD`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapcall_method_static.htm)
statements which are not used here (however, these statements are the
-only option in the context of dynamic programming.
+only option in the context of dynamic programming).
When methods are called, the parameters must be specified within the
parentheses.
@@ -578,7 +577,7 @@ class_name=>stat_meth( ).
"Note that in the method call, the caller exports values to the
"method having importing parameters defined; hence, the ABAP word
-"EXPORTING is relevant. The three following method calls are the same
+"EXPORTING is relevant. The following three method calls are the same
"Explicit use of EXPORTING.
class_name=>meth( EXPORTING a = b ).
@@ -587,7 +586,8 @@ class_name=>meth( EXPORTING a = b ).
class_name=>meth( a = b ).
-"Only a single value must be passed: parameter name (a) and EXPORTING not needed
+"Only a single value must be passed:
+"the formal parameter name (a) and EXPORTING not needed
stat_meth( b ).
@@ -619,6 +619,7 @@ class_name=>meth( CHANGING g = h ).
DATA(result) = class_name=>meth( i = j k = l )
"They can be used with other statements, e. g. logical expressions.
+"In the example below, the assumption is that the returning parameter is of type i.
IF class_name=>meth( i = j k = l ) > 100.
...
ENDIF.
@@ -683,7 +684,7 @@ ENDMETHOD.
- can only handle components in the `PROTECTED` and
`PUBLIC` section of superclasses.
- know their direct superclass but they do not know which classes
- inherit from them. [Note:] Handle component definitions
+ inherit from them. Note: Handle component definitions
and implementations in the superclass with great care since a
change might have undesired consequences for the subclasses.
- Components ...
@@ -714,8 +715,7 @@ ENDMETHOD.
by default.
- The addition
[`ABSTRACT`](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmethods_abstract_final.htm)
- is meant for abstract classes.
-- The addition `ABSTRACT` enters the picture in the context of
+ enters the picture in the context of
abstract classes. These classes are used if you want to have a
template for subclasses and you do not need instances of such
classes. Instances are only possible for their subclasses. Instance
@@ -724,14 +724,12 @@ ENDMETHOD.
declarations](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapclass_options&sap-language=EN&sap-client=000&version=X&anchor=!ABAP_ADDITION_3@3@&tree=X)
(e. g. `CLASS cl DEFINITION ABSTRACT. ...`) and [method
declarations](https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/index.htm?file=abapmethods_abstract_final&sap-language=EN&sap-client=000&version=X&anchor=!ABAP_ADDITION_1@1@&tree=X)
- (e. g. `METHODS meth ABSTRACT. ...`). Abstract methods can
- only be declared within abstract classes. They are not implemented
- in the implementation part of the abstract class. Instead, they must
+ (e. g. `METHODS meth ABSTRACT. ...`). Abstract methods are not implemented
+ in the implementation part of abstract classes. Instead, they must
be redefined in subclasses. Note that in abstract classes,
non-abstract methods can also be declared and that private methods
cannot be redefined, i. e. methods in this section cannot be
- declared as abstract. See a high-level comparison of abstract
- classes and interfaces further down.
+ declared as abstract.