Define access modifiers.- Access modifiers are used to control the scope of type members.
- Access modifier defines the accessibility of the specific type, for example: class, structure, data member etc.
The access modifiers are:
1. Private 2. Public 3. Protected 4. Internal 5. Protected Internal
- The default access level assigned to members of a class is private.
- Private members of a class are accessible only within the class and by friends of the class.
- Protected members are accessible by the class itself and its sub- classes.
- Public members of a class can be accessed by anyone.
- Internal access is limited to the current assembly.
- Protected Internal access is limited to the current assembly or types derived from the containing class.
|