Class Access Modifiers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anybody let me know the difference between public and private class
access modifiers? Thanks in advance
 
kchalla said:
Can anybody let me know the difference between public and private class
access modifiers? Thanks in advance

Do you mean class modifiers(ie public class?) If so there is only public and
internal.
Public means that the class is available to anyone who has referenced the
assembly, while internal means the class is only accessible to the current
assembly.

private on a member means that the member is restricted to the class and its
nested classes.
 
Daniel O'Connell said:
Do you mean class modifiers(ie public class?) If so there is only public and
internal.

Not quite - a nested class can be private, in which case it's only
visible to the enclosing class, or protected in which case it's only
visible to classes derived from the enclosing class.
 
Jon Skeet said:
Not quite - a nested class can be private, in which case it's only
visible to the enclosing class, or protected in which case it's only
visible to classes derived from the enclosing class.

Ahh nested classes, my great nemisis. I constantly forget they exist(One of
my prototype compilers didn't even support them...who knows how I managed to
implement by the spec and still forget nested types). You are quite correct.
 
Back
Top