Inheritance - Static attributes exist only once per inheritance tree
Static attributes only exist once in each inheritance tree. One can change them from outside the class using the class component selector with any class name, or within any class in which they are shared. They are visible in all classes in the inheritance tree.
Class C1 contains static attribute , NUM.
Class C2 and C3 are subclasses of class C1.
In the START-OF-SELECTION block, the static attribute , NUM is changed using reference of class C3.
It gets changed with reference to class C2 also.
Hence, static attribute, NUM, changed via class C3 is also changed with respect to C2 also. This demonstrates the theme.
CLASS c1 DEFINITION .
CLASS-DATA : num TYPE i.
CLASS c1 IMPLEMENTATION .
CLASS c2 DEFINITION INHERITING FROM c1.
CLASS c2 IMPLEMENTATION.
CLASS c3 DEFINITION INHERITING FROM c1.
c3=>num = 10.