encapsulation

Lars Ivar Igesund larsivar at igesund.net
Tue Mar 13 10:37:37 PDT 2007


BCS wrote:

> Reply to arun,
> 
>> class A {
>> private int c=0;
>> }
>> void main() {
>> A a = new A();
>> printf("%d",a.c);
>> }
>> consider the above code snippet..... y there is no error in printf
>> statement a.c , since attribute "c" is private ????
>> 
> 
> Everything inside of a module (a.k.a. file) is visible to everything else
> inside of that module.

It's a variation on C++ friends.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list