<?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: Class attribute adopted from interface - how to set it private in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040771#M1350828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Piotr,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interfaces from definition are public and they do not distinguish any other visibility. One of the reason would be that when you implement this interface in your class, it must be visible in all its subsequent classes (inherintng from this class). For private attributes/methods it wouldn't be feasible, though for protected it would.&lt;/P&gt;&lt;P&gt;Therefore entire definition of interfaces is just inlcuded in public section of class implementing it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moreover the interfaces are mainly designed to behave polimorphically so using one reference variable you can call different methods implementation (interface methods). This must be available from outside of interface/class implementing it. That's why its definition must only be public.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Aug 2009 09:08:46 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2009-08-06T09:08:46Z</dc:date>
    <item>
      <title>Class attribute adopted from interface - how to set it private</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040768#M1350825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there OO-style ABAPers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've just begun an ABAP OO adventure and have such a small problem ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... I created a class, let's say MyClass which has some &lt;STRONG&gt;private&lt;/STRONG&gt; attributes (Let's say MyAttr1, MyAttr2).  Now I'm Implementing an interface let's say MyIface which has an attribute MyIfaceAttribute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But after implementing interface - MyIfaceAttribute is automatically set to &lt;STRONG&gt;public&lt;/STRONG&gt; in MyClass and there is no possibility to edit it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now I've got a small mess:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;private MyAttr1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;private MyAttr2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;public MyIfaceAttribute&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;... whilst I'd like to have them all private&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I change MyIfaceAttribute accessibility implemented in MyClass into &lt;STRONG&gt;private&lt;/STRONG&gt; ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 10:18:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040768#M1350825</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T10:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Class attribute adopted from interface - how to set it private</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040769#M1350826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Pjotr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Private attributes do not make sense in interfaces. In order to "protect" you public interface attribute from being modified externally just define the attribute as &lt;STRONG&gt;READ-ONLY&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;If you want to provide MODIFY access to the attribute you need to add a SET_MYATTRIBUTE method to your interface.&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>Tue, 04 Aug 2009 10:25:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040769#M1350826</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2009-08-04T10:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Class attribute adopted from interface - how to set it private</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040770#M1350827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Uwe Schieferstein&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Private attributes do not make sense in interfaces.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could You please tell me why? I'm a real newbie in object oriented way of thinking, what is the argument not to make private attribute in interface? I would be really thankful for explaining. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings. P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 08:50:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040770#M1350827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-06T08:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Class attribute adopted from interface - how to set it private</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040771#M1350828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Piotr,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interfaces from definition are public and they do not distinguish any other visibility. One of the reason would be that when you implement this interface in your class, it must be visible in all its subsequent classes (inherintng from this class). For private attributes/methods it wouldn't be feasible, though for protected it would.&lt;/P&gt;&lt;P&gt;Therefore entire definition of interfaces is just inlcuded in public section of class implementing it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moreover the interfaces are mainly designed to behave polimorphically so using one reference variable you can call different methods implementation (interface methods). This must be available from outside of interface/class implementing it. That's why its definition must only be public.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 09:08:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040771#M1350828</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-08-06T09:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Class attribute adopted from interface - how to set it private</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040772#M1350829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Once you implement the interface in your class, you can set the Aliases and the visibility of the component.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SE24 (Global class builder) you would find the Aliases tab.&lt;/P&gt;&lt;P&gt;Here you can specify the "simple" name of the attribute and methods as well as you can specify the visibility. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 14:03:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040772#M1350829</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-08-06T14:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Class attribute adopted from interface - how to set it private</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040773#M1350830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Piotr,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in ABAP OO an interface is intended as well known API to deal with. Therefore it would contradictionary to hide elements of an interface. Or in other words if it should´t be public / used by others why should an element part of the interface. Just remove it from the interface and move it to the implementing class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;  Klaus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 19:54:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-attribute-adopted-from-interface-how-to-set-it-private/m-p/6040773#M1350830</guid>
      <dc:creator>former_member183804</dc:creator>
      <dc:date>2009-08-06T19:54:06Z</dc:date>
    </item>
  </channel>
</rss>

