Contents

Class modifiers reference

This page contains reference information for class modifiers.

Valid combinations

#

The valid combinations of class modifiers and their resulting capabilities are:

DeclarationConstruct?Extend?Implement?Mix in?Exhaustive?
classYesYesYesNoNo
base classYesYesNoNoNo
interface classYesNoYesNoNo
final classYesNoNoNoNo
sealed classNoNoNoNoYes
abstract classNoYesYesNoNo
abstract base classNoYesNoNoNo
abstract interface classNoNoYesNoNo
abstract final classNoNoNoNoNo
mixin classYesYesYesYesNo
base mixin classYesYesNoYesNo
abstract mixin classNoYesYesYesNo
abstract base mixin classNoYesNoYesNo
mixinNoNoYesYesNo
base mixinNoNoNoYesNo

Invalid combinations

#

Certain combinations of modifiers are not allowed:

CombinationReasoning
base, interface, and finalAll control the same two capabilities (extend and implement), so are mutually exclusive.
sealed and abstractNeither can be constructed, so are redundant together.
sealed with base, interface, or finalsealed types already cannot be mixed in, extended or implemented from another library, so are redundant to combine with the listed modifiers.
mixin and abstractNeither can be constructed, so are redundant together.
mixin and interface, final, or sealedA mixin or mixin class declaration is intended to be mixed in, which the listed modifiers prevent.
enum and any modifiersenum declarations can't be extended, implemented, mixed in, and can always be instantiated, so no modifiers apply to enum declarations.
extension type and any modifiersextension type declarations can't be extended or mixed in, and can only be implemented by other extension type declarations.