September 19, 2008

c# - Access levels within namespace



Class Constructor Another Class
default default not accessible(cannot
create object)main door(class) is default opened
for others within namespace but not
the room door(constructor)
so they cannot open it.

default public accessible(can create object) - main
door(class) is default opened for others and you
have opened room door(constructor) also so
accessible.

public default not accessible - you made main door(class)
open not only for classes within the namespace but
also for others outside the namespace but you have
not opened the room doors so on one can access it.

public public accessible - Yep Congratulations you have
opened the main
door and also the room door so its accessible.

Caution: Be careful you can loose privacy in the last case

0 comments: