default access modifier

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

Hello!

I want to check with you if the following default accessmodifier is correct.

* Class outer level = Internal
* Class that are nested = private
* field = private
* method = private
* delegate = internal

Is this correct?

Is it any more that I have forgotten?

//Tony
 
Tony said:
I want to check with you if the following default accessmodifier is correct.

* Class outer level = Internal
* Class that are nested = private
* field = private
* method = private
* delegate = internal

Is this correct?

Is it any more that I have forgotten?

Non-class types (enums, interfaces, structs)
Properties
Events
Indexers

Basically, however, it's a simple rule: the default access is the most
private you can declare. The one exception for this is that if you set
one part of a property (i.e. either the getter or the setter) to be a
particular access level, that is always more private than it would be
otherwise.
 
Hello!
You said
Basically, however, it's a simple rule: the default access is the most
private you can declare. The one exception for this is that if you set
one part of a property (i.e. either the getter or the setter) to be a
particular access level, that is always more private than it would be
otherwise.

but how about classes. The most private I can declare is private but the
default access is really Internal.
So have I missunderstood you in some way perhaps?

So according to your statement everything seems to have default access of
private?

//Tony
 
Tony said:
but how about classes. The most private I can declare is private but the
default access is really Internal.

What would be able to use a private outer level class ?

:-)

Arne
 
Tony said:
Hello!
You said

but how about classes. The most private I can declare is private but the
default access is really Internal.
So have I missunderstood you in some way perhaps?

Try declaring a non-nested class as private :)
So according to your statement everything seems to have default access of
private?

Nope - it's as private as you're allowed to declare it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top