The main purpose of using access specifiers is to provide security to the applications. The availability (scope) of the member objects of a class can be controlled using access specifiers. PUBLIC: As the name specifies, it can be accessed from anywhere in the project. If a member of a class is defined as public then it can be accessed anywhere in the class as well as outside the class. This means that objects can access and modify public fields, properties, methods.
Its just like a public property. Anyone can use,modify without any permission. Making and object or method should be done in extreme care, since anyone will be able to modify the value.PRIVATE: As the name suggests, it can't be accessed outside the class. Its the private property of the class and can be accessed only by the members of the class.
This is like an object in our home. We will not allow an outside agent to change or even access that. In programs we will make an objects or methods private only if it has the use only in that particular class.PROTECTED: Protected variables can be used within the class as well as the classes that inherites this class.
Protected is just like a family matter. All the members in that particular family will be allowed to view or modify. DEFAULT: A Default property is a single property of a class that can be set as the default. This allows developers that use your class to work more easily with your default property because they do not need to make a direct reference to the property. Default properties cannot be initialized as Shared/Static or Private and all must be accepted at least on argument or parameter. Default properties do not promote good code readability, so use this option sparingly.
Next : Class Based Object Oriented Programming
Its just like a public property. Anyone can use,modify without any permission. Making and object or method should be done in extreme care, since anyone will be able to modify the value.
This is like an object in our home. We will not allow an outside agent to change or even access that. In programs we will make an objects or methods private only if it has the use only in that particular class.
Protected is just like a family matter. All the members in that particular family will be allowed to view or modify.
DEFAULT: A Default property is a single property of a class that can be set as the default. This allows developers that use your class to work more easily with your default property because they do not need to make a direct reference to the property. Default properties cannot be initialized as Shared/Static or Private and all must be accepted at least on argument or parameter. Default properties do not promote good code readability, so use this option sparingly.
Next : Class Based Object Oriented Programming