Access Modifiers are keywords that define the accessibility of a member, class or datatype in a program. These are mainly used to restrict unwanted data manipulation by external programs or classes. There are 4 access modifiers (public, protected, internal, private) which defines the 6 accessibility levels as follows:
- public
- protected
- internal
- protected internal
- private
- private protected
The Accessibility table of these modifiers is given below:
public
|
protected
|
internal
|
protected internal
|
private
|
private protected
| |
Entire program
|
Yes
|
No
|
No
|
No
|
No
|
No
|
Containing class
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
Yes
|
Current assembly
|
Yes
|
No
|
Yes
|
Yes
|
No
|
No
|
Derived types
|
Yes
|
Yes
|
No
|
Yes
|
No
|
No
|
Derived types within current assembly
|
Yes
|
Yes
|
No
|
Yes
|
No
|
Yes
|
No comments:
Post a Comment