Access Specifiers defines the scope of a class member (variable or
function).
Five types of access specifiers:
- Public Access Specifiers - can be accessed from anywhere even outside the namespace
- Private Access Specifiers - hides its member variable and method from other class and methods. However, get(return value- retrieving value from private field) set(return void - store value in private variables) property can retrieve or store private access modifiers values.
- Protected Access Specifiers - member variable and method can only be accessed in child class
- Internal Access Specifiers - hides its member variables and methods from other classes and objects in other namespace
- Protected Internal Access Specifiers.- allows its members to be accessed in derived class, containing class or classes within the same namespace.
No comments:
Post a Comment