<?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: classes in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824499#M351925</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Public&amp;lt;/b&amp;gt; classes can, obviously, instantiated by everybody. &lt;/P&gt;&lt;P&gt;Example: CL_GUI_ALV_GRID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instantiating &amp;lt;b&amp;gt;protected&amp;lt;/b&amp;gt; or &amp;lt;b&amp;gt;private&amp;lt;/b&amp;gt; classes you will need a static CREATE method. &lt;/P&gt;&lt;P&gt;Example: CL_RECA_MESSAGE_LIST (created by calling CF_RECA_MESSAGE_LIST=&amp;gt;CREATE( ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will use the second approach if you want to specifically control the instantiating of your class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Jan 2007 08:23:06 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2007-01-22T08:23:06Z</dc:date>
    <item>
      <title>classes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824497#M351923</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;      I want the differences between the public, private and protected classes with examples..Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:04:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824497#M351923</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-22T08:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: classes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824498#M351924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. &amp;lt;b&amp;gt;Public attributes&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Public attributes are defined in the PUBLIC section and can be viewed and changed from outside the class. There is direct access to public attributes. As a general rule, as few public attributes should be defined as possible.&lt;/P&gt;&lt;P&gt;PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;  DATA: Counter type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Public methods&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Can called from outside the class&lt;/P&gt;&lt;P&gt;PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;  METHODS:  set_attributes IMPORTING p_name(25) TYPE c,&lt;/P&gt;&lt;P&gt;                                                            p_planetype LIKE saplane-planetyp,&lt;/P&gt;&lt;P&gt;2. &amp;lt;b&amp;gt;Private attributes&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Private attributes are defined in the PRIVATE section. The can only be viewes and changed from within the class. There is no direct access from outside the class.&lt;/P&gt;&lt;P&gt;PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;    DATA: name(25) TYPE c,&lt;/P&gt;&lt;P&gt;          planetype LIKE saplane-planetyp,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Private methods&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Can only be called from inside the class. They are placed in the PRIVATE section of the class. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.&amp;lt;b&amp;gt;Protected components&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;When we are talking subclassing and inheritance there is one more component than Public and Private, the Protected component. Protected components can be used by the superclass and all of the subclasses. Note that Subclasses cannot access Private components.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/sap/abap/OO/eg.htm" target="test_blank"&gt;http://www.erpgenie.com/sap/abap/OO/eg.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:17:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824498#M351924</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-22T08:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: classes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824499#M351925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Public&amp;lt;/b&amp;gt; classes can, obviously, instantiated by everybody. &lt;/P&gt;&lt;P&gt;Example: CL_GUI_ALV_GRID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instantiating &amp;lt;b&amp;gt;protected&amp;lt;/b&amp;gt; or &amp;lt;b&amp;gt;private&amp;lt;/b&amp;gt; classes you will need a static CREATE method. &lt;/P&gt;&lt;P&gt;Example: CL_RECA_MESSAGE_LIST (created by calling CF_RECA_MESSAGE_LIST=&amp;gt;CREATE( ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will use the second approach if you want to specifically control the instantiating of your class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 08:23:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824499#M351925</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-01-22T08:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: classes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824500#M351926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Refer this link&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/b3/f4b1406fecef0fe10000000a1550b0/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/b3/f4b1406fecef0fe10000000a1550b0/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Judith Jessie Selvi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2007 09:28:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824500#M351926</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-22T09:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: classes</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824501#M351927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The class visibility refers to its instantiation: CREATE OBJECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As already mentioned in other replies but in a different way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public: CREATE OBJECT can be called from anywhere&lt;/P&gt;&lt;P&gt;Protected: CREATE OBJECT can be called from the class and its subclasses&lt;/P&gt;&lt;P&gt;Private: CREATE OBJECT can only be called from within the class&lt;/P&gt;&lt;P&gt;Abstract: CREATE OBJECT cannot be called at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, I mean CREATE OBJECT &amp;lt;i&amp;gt;variable_type_ref_to_the_class&amp;lt;/i&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Private instantiation is typically used for the SINGLETON pattern where you allow only one instance of your class to exist.  In such case, I always create a static method GET_INSTANCE() which returns the singleton instance of my class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Abstract instantiation is used when a class represents an interface with a base implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected instantiation is less common and used in particular cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Feb 2007 18:56:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/classes/m-p/1824501#M351927</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-13T18:56:43Z</dc:date>
    </item>
  </channel>
</rss>

