Menu

keywords-static

Will Pittenger

Overview

When applied to a method, data member, or property; causes that method, data member, or property to be independent of any specific instance of the enclosing type. Methods and properties that are static can't use the self keyword. Methods, data members, and properties that are static can be accessed with "/TypeName/./MemberMethodOrPropertyIdentifier/". No typecast may be declared as static. All operator procedures are implicitly static. Nested types declared with the inner keyword may not be declared as static. While a property can be static, static can't be explicitly applied to the get or set accessors for that property. Constant members declared with the const keyword, but not the var keyword, are implicitly static. No procedure or property declared as static may also be virtual or abstract.

When applied to the declaration of a class or structure causes all data members, methods, and properties of that type to be implicitly static. No type of enum, even structure-based enums, can be declared as static. No type of interface can be declared as static.

Type declarations

[\static\] [\const\] (\class\ | \structure\) /identifier/
    {[\extends\ /BaseTypeList/] |
    [\implements\ /InterfaceList]}
  ' The rest of the declaration goes here

Method, data member, and property declarations

Data members

(\public\ | \protected\ | \private\) {\var\ [\const\]} [\readonly\] [\static\] [(\ref\ | \byvalue\)] /TypeDescriptor/ /identifier/ [\=\ /DefaultValue/]

For more on what /TypeDescriptor/ can be, see Type descriptors.

Commands

(\public\ | \protected\ | \private\) (\virtual\ | \abstract\ | \final\) [\const\] [\static\] \command\ /identifier/ [/DeclarationSequence/]
    [\throws\ /ExceptionList/]
  ' Implement the command

For more on what /DeclarationSequence/ can be, see Declaration sequences.

Functions

(\public\ | \protected\ | \private\) (\virtual\ | \abstract\ | \final\) [\const\] [\static\] \function\ /identifier/ [/DeclarationSequence/]
    {\returns\ /TypeDescriptor/ |
    [\throws\ /ExceptionList/]}
  ' Implement the function

Complex statements

(\public\ | \protected\ | \private\) (\virtual\ | \abstract\ | \final\) [\const\] [\static\] \statement\ /identifier/ [/DeclarationSequence/]
    {\instructions\ /TypeDescriptorList/ |
    [\throws\ /ExceptionList/]}
  ' Implement the function

For more on what /TypeDescriptorList/ can be, see the section [Complex statements] and the keyword instructions.

Properties

(\public\ | \protected\ | \private\) (\virtual\ | \abstract\ | \final\) [\const\] [\static\] \property\ /TypeDescriptor/ /identifier/ [\[\/DeclarationSequence/\]\]
  [(\protected\ | \private\) (\virtual\ | \abstract\ | \final\) \get\
    ' Implement the accessor
  ]

  [(\protected\ | \private\) (\virtual\ | \abstract\ | \final\) \set\
    ' Implement the accessor
  ]

Related

Wiki: Complex Statements
Wiki: Keywords
Wiki: keywords-abstract
Wiki: keywords-class
Wiki: keywords-const
Wiki: keywords-get
Wiki: keywords-instructions
Wiki: keywords-interface
Wiki: keywords-operator
Wiki: keywords-property
Wiki: keywords-set
Wiki: keywords-structure
Wiki: keywords-var