Class modifiers reference
This page contains reference information for class modifiers.
Valid combinations
The valid combinations of class modifiers and their resulting capabilities are:
| Declaration | Construct? | Extend? | Implement? | Mix in? | Exhaustive? | |
|---|---|---|---|---|---|---|
| class | Yes | Yes | Yes | No | No | |
| base class | Yes | Yes | No | No | No | |
| interface class | Yes | No | Yes | No | No | |
| final class | Yes | No | No | No | No | |
| sealed class | No | No | No | No | Yes | |
| abstract class | No | Yes | Yes | No | No | |
| abstract base class | No | Yes | No | No | No | |
| abstract interface class | No | No | Yes | No | No | |
| abstract final class | No | No | No | No | No | |
| mixin class | Yes | Yes | Yes | Yes | No | |
| base mixin class | Yes | Yes | No | Yes | No | |
| abstract mixin class | No | Yes | Yes | Yes | No | |
| abstract base mixin class | No | Yes | No | Yes | No | |
| mixin | No | No | Yes | Yes | No | |
| base mixin | No | No | No | Yes | No | 
Invalid combinations
Certain combinations of modifiers are not allowed:
| Combination | Reasoning | 
|---|---|
| base,interface, andfinal | All control the same two capabilities ( extendandimplement), so are mutually exclusive. | 
| sealedandabstract | Neither can be constructed, so are redundant together. | 
| sealedwithbase,interface, orfinal | sealedtypes already cannot be mixed in, extended or implemented from another library, so are redundant to combine with the listed modifiers. | 
| mixinandabstract | Neither can be constructed, so are redundant together. | 
| mixinandinterface,final, orsealed | A mixinormixin classdeclaration is intended to be mixed in, which the listed modifiers prevent. | 
| enumand any modifiers | enumdeclarations cannot be extended, implemented, mixed in, and can always be instantiated, so no modifiers apply toenumdeclarations. |