471,616 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,616 software developers and data experts.

Class Access Modifiers

Can anybody let me know the difference between public and private class
access modifiers? Thanks in advance
Jul 21 '05 #1
3 1652

"kchalla" <ke**********@hotmail.com> wrote in message
news:D6**********************************@microsof t.com...
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.
Jul 21 '05 #2
Daniel O'Connell [C# MVP] <onyxkirx@--NOSPAM--comcast.net> wrote:
"kchalla" <ke**********@hotmail.com> wrote in message
news:D6**********************************@microsof t.com...
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.


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 - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #3

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Daniel O'Connell [C# MVP] <onyxkirx@--NOSPAM--comcast.net> wrote:
"kchalla" <ke**********@hotmail.com> wrote in message
news:D6**********************************@microsof t.com...
> 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.


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.
Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Jason Heyes | last post: by
4 posts views Thread by Picho | last post: by
3 posts views Thread by kchalla | last post: by
4 posts views Thread by tony | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.