Skip to content

Modifier Reference

nova ✩ edited this page Oct 14, 2026 · 7 revisions

public

Applicable to: Fields, Methods

Can be accessed from anywhere regardless of context.

protected

Applicable to: Fields, Methods

Protected fields and methods are private unless accessed from a class that inherits it or from any implementing methods in an anonymous instance. Protected fields can also be set by key in the new instance section.

private

Applicable to: Fields, Methods

This is the strictest access type. Private fields and methods can only be accessed from within the exact class they were defined in.

static

Applicable to: Fields, Methods

Static means that a field/method is scoped into a particular class, but does not belong to any particular instance. Instead of specifying an instance in the call, you just write the class name. For example: ClassName::methodName()

override

Applicable to: Methods

When extending a class, use this keyword to specify methods you want to override the behavior of. It will error if a method would override but does not have this keyword.

abstract

Applicable to: Classes, Methods

If a class is marked 'abstract', its methods can be implemented anonymously. It may also contain abstract methods which must be implemented by any future inheritors.

const

Applicable to: Fields

Constant fields can only be defined as default values or in the new instance section when creating an instance. After this they can't be set anymore.

final

Applicable to: Classes, Methods

Final methods cannot be overridden by inheritors, regardless of access type. Final classes can't be extended at all.

Clone this wiki locally