‎2007 Aug 15 10:28 AM
Could anybody explain me regarding the public, private, protected visibilities.
‎2007 Aug 15 10:33 AM
Hi
seer the diff
Access--
members of the same class--- yes -yes--
yes
members of derived classes -yes- yes----
no
not members--
no
please reward points for helpful ans's
kiran.M
Message was edited by:
Kiran Machavarapu
‎2007 Aug 15 10:35 AM
Hi Tazeen,
Welcome to SDN....
<b>Public attributes</b>
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.
PUBLIC SECTION.
DATA: Counter type i.
<b>Private attributes</b>
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.
PRIVATE SECTION.
DATA: name(25) TYPE c,
planetype LIKE saplane-planetyp,
<b>Protected components</b>
When we are talking subclassing and enheritance 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.
Thanks,
Vinay