www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - d- encapsulation

reply arun s <1986.arun gmail.com> writes:
i want to know how the encapsulation rules works in D.
i have made a attribute as private in the class, but am able to access this
attribute directly from the class instance...can any body give reason for
this??? 
Mar 13 2007
next sibling parent BCS <ao pathlink.com> writes:
Reply to arun,

 i want to know how the encapsulation rules works in D.
 
 i have made a attribute as private in the class, but am able to access
 this attribute directly from the class instance...can any body give
 reason for this???
 

If the two classes are in the same file this will happen (private only limits access to the module). If they are in different modules than this would be a bug, however IIRC there are a few bugs of this type around.
Mar 13 2007
prev sibling parent reply Tomas Lindquist Olsen <tomas famolsen.dk> writes:
arun s wrote:

 i want to know how the encapsulation rules works in D.
 i have made a attribute as private in the class, but am able to access
 this attribute directly from the class instance...can any body give reason
 for this???

You should post some code for decent replies.
Mar 13 2007
parent reply Kyle Furlong <kylefurlong gmail.com> writes:
Tomas Lindquist Olsen wrote:
 arun s wrote:
 
 i want to know how the encapsulation rules works in D.
 i have made a attribute as private in the class, but am able to access
 this attribute directly from the class instance...can any body give reason
 for this???

You should post some code for decent replies.

Formatting, punctuation, capitalization, spelling, and grammar would all go a long way toward getting decent replies as well.
Mar 13 2007
parent janderson <askme me.com> writes:
Kyle Furlong wrote:
 Tomas Lindquist Olsen wrote:
 arun s wrote:

 i want to know how the encapsulation rules works in D.
 i have made a attribute as private in the class, but am able to access
 this attribute directly from the class instance...can any body give 
 reason
 for this???

You should post some code for decent replies.

Formatting, punctuation, capitalization, spelling, and grammar would all go a long way toward getting decent replies as well.

Really? Then I feel sorry for people who's primary language is not English. -Joel
Mar 14 2007