-5

Plz also specify the difference between access specifiers and access modifiers in c# so if possible give me reference of msdn also

  • [access specifiers = access modifiers](http://msdn.microsoft.com/en-us/library/ms173121.aspx) and [What are the Default Access Modifiers in C#?](http://stackoverflow.com/questions/2521459/what-are-the-default-access-modifiers-in-c) – Soner Gönül Aug 29 '14 at 07:03
  • 5
    Why not simply search on MSDN if you know it exists? – Dirk Aug 29 '14 at 07:03
  • "default access modifier in C#" in Google says it is `private`. Reading the MSDN shows that "Classes and structs that are declared directly within a namespace (in other words, that are not nested within other classes or structs) can be either public or internal. **Internal** is the default if no access modifier is specified." – SimpleVar Aug 29 '14 at 07:04

2 Answers2

0

The default access modifiers for classes is internal and their constructors is 'private'.

Community
  • 1
  • 1
Chrisi
  • 371
  • 3
  • 15
  • 1
    "for classes" is not quite right; for top-level classes it is `internal`; for nested classes it is `private`; both are "classes". – Marc Gravell Aug 29 '14 at 07:09
0

Have a look @Difference between access specifier and access modifier

In this context, you can think of access specifiers as protection specifiers -- they specify where a variable can be accessed from. By contrast, access modifiers are completely different; they specify how variables should (or should not) be accessed; e.g. read-only, volatile, etc.

i.e., a variable can be public but read-only, or it can be private and writable -- the access specifiers have nothing to do with the modifiers.

However, I'm a little surprised that the terminology is for C#, since Microsoft actually calls public and private "access modifiers", and it calls volatile and readonly just plain "modifiers".

Community
  • 1
  • 1
SteMa
  • 421
  • 6
  • 13