Why is the default for an access modifier "protected" in . NET?

Asked

Viewed 50 times

4

Unless I’m mistaken, the default when no class modifier is defined, for example, is assumed to be the protected:

class LoremIpsum {
    ...
}

Is there any special reason for this? Which?

1 answer

6


The default access modifier for a class is not the protected. Is the internal.

The default access modifier for a class method is the private.

According to answer from Jon Skeet, this is due to the security of the primary language by the greatest possible restriction.

Has more:

Language specification: http://www.microsoft.com/download/details.aspx?id=7029

  • 3

    Besides protected not even be possible inside a namespace... it is only possible to define a type protected as a subtype of another kind.

  • 1

    And I was wrong :) Thank you very much for the agility and quality of your reply. I found a complementary link in the MSDN

Browser other questions tagged

You are not signed in. Login or sign up in order to post.