Access modifiers define which classes can access properties, variables, methods, and other classes. If an access modifier is not specified, the
access level defaults to internal
, which grants access to all classes in the same package. This may be what is intended, but it should be
specified explicitly to avoid confusion.
Available access modifiers are:
-
internal
- access allowed within the same package
-
private
- access allowed only within the same class
-
protected
- access allowed to the class and its child classes
-
public
- unfettered access by all
Noncompliant code example
function checkResources():Boolean {
...
return true;
}
Compliant solution
public function checkResources():Boolean {
...
return true;
}