Google Search - Blog...........

ABAP - OOPS: Static Attributes Exist Only Once Per Inheritance Tree In Method Programming

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.
-------------------------------------------------------------------------------------------

REPORT YSUBDEL.

CLASS C1 DEFINITION .
PUBLIC SECTION.
class-data : num type i.
ENDCLASS.

CLASS C1 IMPLEMENTATION .
ENDCLASS.

CLASS C2 DEFINITION INHERITING FROM C1.
ENDCLASS.

CLASS C2 IMPLEMENTATION.
endclass.

CLASS C3 DEFINITION INHERITING FROM C1.
ENDCLASS.


START-OF-SELECTION.
C3=>NUM = 10.
WRITE:/5 C2=>NUM.



Output 10

No comments:

Post a Comment