Menu

keywords-override

Will Pittenger

Overview

Allows you to override a virtual or abstract method or property. If the method or property you want to "override" isn't virtual or abstract, use new instead as you're actually hiding something in your base type. Just place override where what you want to override used the virtual/abstract keyword. You also need override for methods and properties declared in an interface.

Commands

(\public\ | \protected\ | \private\) \override\ [\const\] [\final\] \command\ /identifier/ /DeclarationSequence/
  [\throws\ /ExceptionList/]

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

Functions

(\public\ | \protected\ | \private\) \override\ [\const\] [\final\] \function\ /identifier/ /DeclarationSequence/
  {\returns\ /TypeDescriptor/ |
  [\throws\ /ExceptionList/]}

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

Complex statements

(\public\ | \protected\ | \private\) \override\ [\const\] [\final\] \statement\ /identifier/ /DeclarationSequence/
  [\throws\ /ExceptionList/]
  [\instructions\ /TypeList/]

For more on what /TypeList/ can be, see the instructions keyword.

Properties

This only applies if the property itself was itself declared as virtual or abstract. If it was one of the properties accessors, see the next section. If override is needed on the property itself, you don't need it on the accessors.

(\public\ | \protected\ | \private\) \override\ [\final\] \property\ /TypeDescriptor/ /identifier/ [\[\/DeclarationSequence/\]\]
  ' Implement get and get accessors as needed

Property accessors

This only applies if the accessor is what was declared as virtual or abstract. If the parent property was declared as virtual or abstract, put override there as described above.

[(\public\ | \protected\ | \private\)] \override\ [\final\] (\get\ | \set\)
    [\throws\ /ExceptionList/]
  ' Implement the accessor.

Related

Wiki: Appendices-Terms-Type descriptors
Wiki: Keywords
Wiki: keywords-abstract
Wiki: keywords-instructions
Wiki: keywords-interface
Wiki: keywords-new
Wiki: keywords-virtual