<?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: Difference between public and private in oops? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218498#M767516</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;Differences are:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public: - all declarations in this section(methods, data, events etc) can access and changed from outside the class and also and external user can instantiate the class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected: - all declarations in this section(methods, data, events etc) can access by  that class and its subclasses by inheritance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected:-&lt;/P&gt;&lt;P&gt;all declarations in this section(methods, data, events etc) can access by  that class and its friends by granting friendship to that class to access its private attributes.&lt;/P&gt;&lt;P&gt;and also by public methods in which intern which calls private methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public:-&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;Private attributes&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;Instance attributes&lt;/P&gt;&lt;P&gt;There exist one instance attribute for each instance of the class, thus they exist seperately for each object. Instance attributes are declared with the DATA keyword.&lt;/P&gt;&lt;P&gt;Static attributes&lt;/P&gt;&lt;P&gt;Static attributes exist only once for each class. The data are the same for all instances of the class, and can be used e.g. for instance counters. Static attributes are defined with the keyword CLASS-DATA.&lt;/P&gt;&lt;P&gt;PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLASS-DATA: counter type i,   &lt;/P&gt;&lt;P&gt;Public methods&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;&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;&lt;/P&gt;&lt;P&gt;Private methods&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;Protected components&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 29 Dec 2007 11:30:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-29T11:30:30Z</dc:date>
    <item>
      <title>Difference between public and private in oops?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218497#M767515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi to all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the exact difference between &lt;/P&gt;&lt;P&gt;public &lt;/P&gt;&lt;P&gt;private&lt;/P&gt;&lt;P&gt;protected&lt;/P&gt;&lt;P&gt;in obect oriented language.and where we use this respectively.&lt;BR /&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;Thanks and regards,&lt;/P&gt;&lt;P&gt;swami&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Dec 2007 11:15:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218497#M767515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-29T11:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between public and private in oops?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218498#M767516</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;Differences are:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public: - all declarations in this section(methods, data, events etc) can access and changed from outside the class and also and external user can instantiate the class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected: - all declarations in this section(methods, data, events etc) can access by  that class and its subclasses by inheritance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected:-&lt;/P&gt;&lt;P&gt;all declarations in this section(methods, data, events etc) can access by  that class and its friends by granting friendship to that class to access its private attributes.&lt;/P&gt;&lt;P&gt;and also by public methods in which intern which calls private methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public:-&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;Private attributes&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;Instance attributes&lt;/P&gt;&lt;P&gt;There exist one instance attribute for each instance of the class, thus they exist seperately for each object. Instance attributes are declared with the DATA keyword.&lt;/P&gt;&lt;P&gt;Static attributes&lt;/P&gt;&lt;P&gt;Static attributes exist only once for each class. The data are the same for all instances of the class, and can be used e.g. for instance counters. Static attributes are defined with the keyword CLASS-DATA.&lt;/P&gt;&lt;P&gt;PRIVATE SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLASS-DATA: counter type i,   &lt;/P&gt;&lt;P&gt;Public methods&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;&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;&lt;/P&gt;&lt;P&gt;Private methods&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;Protected components&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Dec 2007 11:30:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218498#M767516</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-29T11:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between public and private in oops?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218499#M767517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for more secure purpose , v r usin the concept of public &amp;amp; private fun.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;public function visible to all.&lt;/P&gt;&lt;P&gt;private means its for particular. (Encapsulation)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as of  OOPS is concern.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;field should be declared as private&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; where as &lt;STRONG&gt;function are declared as public.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this public/private/protected are very useful ven ever using the " Inheritance concept"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;public&lt;/STRONG&gt;: class members are access from the outside the class&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;private&lt;/STRONG&gt;: class members can access only within the class&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;protected:&lt;/STRONG&gt;class members can access inside the same package&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     &lt;STRONG&gt;Public variables,&lt;/STRONG&gt; are variables that are visible to all classes.&lt;/P&gt;&lt;P&gt;     &lt;STRONG&gt;Private variables&lt;/STRONG&gt;, are variables that are visible only to the class to which they belong.&lt;/P&gt;&lt;P&gt;     &lt;STRONG&gt;Protected variables,&lt;/STRONG&gt; are variables that are visible only to the class to which they belong, and any subclasses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope u got it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Dec 2007 11:34:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218499#M767517</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-29T11:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between public and private in oops?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218500#M767518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;      Please find the answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Public: When u declare a method/variable as public, then when u create a object to the class. u can access those things (outside the class).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Private: When u declare a method/variable as private, then when u create a object to the class. u can't access those things (outside the class). Only the public/protected methods can access these things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Protected: Same as public but it can be accessed only by its derived class. For example, say class A has a method method1 as protected. Class B is derived from Class A. So when u create a object for class B, u can access method1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Niyaz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Dec 2007 11:35:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-public-and-private-in-oops/m-p/3218500#M767518</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-29T11:35:25Z</dc:date>
    </item>
  </channel>
</rss>

