Access modifiers
- Last UpdatedApr 24, 2024
- 1 minute read
Available access modifiers are:
-
public, which is the default accessibility level and means access is not restricted.
-
private, which is the least permissive access level and means access to members is allowed only within the body of the class.
Access modifiers are only allowed on classes variables and methods. They are not allowed on namespaces and classes. Only one access modifier is allowed for a class variable or method.