Overriding Methods

From RAD Studio
Jump to: navigation, search

Go Up to Virtual Methods


Overriding a method means extending or refining it, rather than replacing it. A descendent class can override any of its inherited virtual methods.

To override a method in a descendent class, add the directive override to the end of the method declaration.

Overriding a method causes a compilation error if:

  • The method does not exist in the ancestor class.
  • The ancestor's method of that name is static.
  • The declarations are not otherwise identical (number and type of arguments parameters differ).

See Also