<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: private and protected section in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139364#M746034</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Satish!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the change to your code which will make it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;public&lt;/STRONG&gt; section.&lt;/P&gt;&lt;P&gt;methods : meth1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private section. &lt;/P&gt;&lt;P&gt;data : privatedata(30) type c value 'Private data'.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method meth1.&lt;/P&gt;&lt;P&gt;write : / 'hi i am in meth1'.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; sy-uline.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; privatedata.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : obj type ref to c1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object: obj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call method : obj-&amp;gt;meth1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, you can do the following as Stefan suggested:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;public section.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;methods: meth0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;protected section.&lt;/P&gt;&lt;P&gt;methods : meth1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private section. &lt;/P&gt;&lt;P&gt;data : privatedata(30) type c value 'Private data'.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;method meth0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call method meth1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;write privatedata.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endmethod.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method meth1.&lt;/P&gt;&lt;P&gt;write : / 'hi i am in meth1'.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; sy-uline.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; privatedata.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : obj type ref to c1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object: obj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call method : obj-&amp;gt;meth0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;P&gt;Vladan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Dec 2007 13:29:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-20T13:29:12Z</dc:date>
    <item>
      <title>private and protected section</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139360#M746030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;        Below is my code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;protected section.&lt;/P&gt;&lt;P&gt;  methods : meth1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;private section.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; data : privatedata(30) type c value 'Private data'.&lt;/P&gt;&lt;P&gt; ENDCLASS.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;class c1 implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method meth1.&lt;/P&gt;&lt;P&gt;write : / 'hi i am in meth1'.&lt;/P&gt;&lt;P&gt; write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; sy-uline.&lt;/P&gt;&lt;P&gt; write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; privatedata.&lt;/P&gt;&lt;P&gt; endmethod.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : obj type ref to c1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object: obj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call method : obj-&amp;gt;meth1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frnds like i wanted to have the exact usage of Private , Protected section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i know the definition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Private section  : visible only to the class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected : visible to class and its subclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So here in my example C1 is the same class so why we are unable to access "PRIVATE" and "PROTECTED".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 11:24:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139360#M746030</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T11:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: private and protected section</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139361#M746031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check below...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public Section&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected Section&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. Protected components form a special interface between a class and its subclasses. Since inheritance is not active in Release 4.5B, the protected section currently has the same effect as the private section. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Private Section&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The components of a class can only be accessed through the objects but declaring the class&lt;/P&gt;&lt;P&gt;components in different domains, which are defined as Public Private and Protected, these&lt;/P&gt;&lt;P&gt;domains control the accessibility.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public components of a class can be accessed by the objects of a class components in the&lt;/P&gt;&lt;P&gt;public domain are totally visible outside the class other components within the class can also&lt;/P&gt;&lt;P&gt;access them.&lt;/P&gt;&lt;P&gt;Private components cannot be accessed by the objects of the class they can only be accessed&lt;/P&gt;&lt;P&gt;by the members within the class i.e. any member function within the class can access the&lt;/P&gt;&lt;P&gt;private members thus from the point of visibility no private components are visible outside&lt;/P&gt;&lt;P&gt;class. The sequence of declaring the components are public protected and private.&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;CLASS my_class DEFINITION.&lt;/P&gt;&lt;P&gt;PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;METHODS: test_method.&lt;/P&gt;&lt;P&gt;PROTECTED SECTION.&lt;/P&gt;&lt;P&gt;PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;DATA: name TYPE C.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;CLASS my_class IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;METHOD test_method.&lt;/P&gt;&lt;P&gt;Write:/ &amp;#145; this is my test method&amp;#146;.&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds&lt;/P&gt;&lt;P&gt;Sivaparvathi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward points if helpful.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 11:34:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139361#M746031</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T11:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: private and protected section</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139362#M746032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Satish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private means that you can only access the attribute/method within the class. So define an public method in your class which access the private methods or attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With protected it is the same, but if you inherite from this class, the subclass can also use access you method/attribute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You meth1 is protected, so it can't be called from outside (from your obj).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 11:35:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139362#M746032</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T11:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: private and protected section</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139363#M746033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Satish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see below points on visibility sections from SAP help. According that Protected section is not available to all users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public Section&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. &lt;STRONG&gt;_The public components of the class form the interface between the class and its users.&lt;/STRONG&gt;_&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected Section&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. &lt;STRONG&gt;&lt;U&gt;Protected components form a special interface between a class and its subclasses&lt;/U&gt;.&lt;/STRONG&gt; Since inheritance is not active in Release 4.5B, the protected section currently has the same effect as the private section. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Private Section&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 11:53:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139363#M746033</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T11:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: private and protected section</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139364#M746034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Satish!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the change to your code which will make it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;public&lt;/STRONG&gt; section.&lt;/P&gt;&lt;P&gt;methods : meth1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private section. &lt;/P&gt;&lt;P&gt;data : privatedata(30) type c value 'Private data'.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method meth1.&lt;/P&gt;&lt;P&gt;write : / 'hi i am in meth1'.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; sy-uline.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; privatedata.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : obj type ref to c1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object: obj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call method : obj-&amp;gt;meth1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, you can do the following as Stefan suggested:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;public section.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;methods: meth0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;protected section.&lt;/P&gt;&lt;P&gt;methods : meth1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private section. &lt;/P&gt;&lt;P&gt;data : privatedata(30) type c value 'Private data'.&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class c1 implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;method meth0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call method meth1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;write privatedata.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endmethod.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method meth1.&lt;/P&gt;&lt;P&gt;write : / 'hi i am in meth1'.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; sy-uline.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; privatedata.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : obj type ref to c1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object: obj.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call method : obj-&amp;gt;meth0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;P&gt;Vladan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Dec 2007 13:29:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/private-and-protected-section/m-p/3139364#M746034</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-20T13:29:12Z</dc:date>
    </item>
  </channel>
</rss>

