Advertisement
p0lich

Untitled

Aug 11th, 2022
3,042
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.34 KB | None | 0 0
  1. class TestClass definition.
  2.     class-data: staticValue type int value 0.
  3.  
  4.     public Section.
  5.         data: pubValue type string value 'public value',
  6.               inc type int value 0.
  7.         methods pubMeth1,
  8.                 pubMeth2,
  9.                 pubMeth3,
  10.                 increaseStaticValue importing val type int
  11.                                     exporting result type int.
  12.                
  13.     protected Section.
  14.         data: protSection type string value 'protected value'.
  15.         methods protMethod1.
  16.        
  17.     private Section.
  18.         data: privSection type string value 'private Section'.
  19.         methods privMethod1.
  20. endclass.
  21.  
  22. class TestClass implementation.
  23.     method pubMeth1.
  24.         write: / concatenate 'access from public method with ' into pubValue.
  25.     endmethod.
  26.    
  27.     method pubMeth2.
  28.         write: / 'list of class values: ' concatenate pubValue .
  29.     endmethod.
  30.    
  31.     method pubMeth3.
  32.         inc = inc + 1.
  33.     endmethod.
  34.    
  35.     method increaseStaticValue.
  36.         write: / 'call of' concatenate pubValue.
  37.     endmethod.
  38.    
  39.     method protMeth1.
  40.         write: / 'call of' concatenate pubValue.
  41.     endmethod.
  42.    
  43.     method privMeth1.
  44.         write: / 'call of' concatenate pubValue.
  45.     endmethod.
  46. endclass.
  47.  
  48. data class_obj type ref to TestClass.
  49.  
  50. class_obj->pubMeth1().
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement