Access Modifiers in C#
There are five access modifiers in C#.NET. They are:
1. Public
2. Private
3. Protected
4. Internal
5. Protected Internal
1. Private:
The method with private as access modifier can be accessed with in the block of class only.
2. Public:
Public is also known as global access modifier.
The method with public as access modifier can be accessed from anywhere.
3. Protected:
The method with protected as access modifier can be accessed only from the inherited classes.
4. Internal:
The method with internal as access modifier can be accessed from anywhere within the project.
5. Protected Internal:
Protected internal is an access modifier that acts as internal within the project and acts as protected outside the project.
1. Public
2. Private
3. Protected
4. Internal
5. Protected Internal
1. Private:
The method with private as access modifier can be accessed with in the block of class only.
2. Public:
Public is also known as global access modifier.
The method with public as access modifier can be accessed from anywhere.
3. Protected:
The method with protected as access modifier can be accessed only from the inherited classes.
4. Internal:
The method with internal as access modifier can be accessed from anywhere within the project.
5. Protected Internal:
Protected internal is an access modifier that acts as internal within the project and acts as protected outside the project.
No comments: