.
Encapsulation in C# Assignment Help
ENCAPSULATION
- The process of shielding one or more things physically or logically inside a package is called encapsulation.
- It prevents ease of access
- It is implemented using access modifiers which defines the scope and visibility of a className
- C# has the following access specifiers
- Public
- Private
- Protected
- Internal
- Protected internal
Encapsulation in C# Assignment Help By Online Tutoring and Guided Sessions from assignmenthippo.com
Public Access Specifier
- Public access specifier grants a classNameto share all its properties to all other classes outside.
Private Access Specifier
- Private access specifier does not grant any permission to share its properties
- Its hide from all other classes
- Only the same classNamehas the right to use its private members.
Protected Access Specifier
- Protected access specifier grants a child classNameto share the member variables and member functions of its immediate base className.
Internal Access Specifier
- Internal access specifier grants a classNameto render its members to other objects in the current assembly
- With an internal access specifier any classNamewithin the application in which the member is defined can be accessed
Protected Internal Access Specifier
- The protected internal access specifier hides its members from all other classes except a child classNamewithin the same application.
.