Unless I'm wrong, the default when a modifier of a class is not defined, for example, is assumed to be protected
:
class LoremIpsum {
...
}
Is there any special reason for this? which?
Unless I'm wrong, the default when a modifier of a class is not defined, for example, is assumed to be protected
:
class LoremIpsum {
...
}
Is there any special reason for this? which?
The default access modifier for a class is not protected
. This is internal
.
The default access modifier for a method in a class is private
.
According to Jon Skeet's response, this is due to the security of the language that prevails because of the greatest restriction possible.
There are more:
public
by default; internal
by default, but their members are < a href="http://msdn.microsoft.com/en-us/library/yzh058ae.aspx"> public
; internal
by default; struct
are private
by default;
internal
by default, with their members always < a href="http://msdn.microsoft.com/en-us/library/yzh058ae.aspx"> public
; Language Specification: link