Improve this page

@virtual

Standardization: Extended
Syntax kind: Modifier

Usage

This modifier has similar semantics to the virtual keyword in C# or Java. For a member function or property, explicitly indicates that subclasses may override (i.e. redefine) the member.

A documentation tool may enforce that the @virtual, @override, and/or @sealed modifiers are consistently applied, but this is not required by the TSDoc standard.

Example

In the code sample below, Child.render() overrides the virtual member Base.render():

class Base {
  /** @virtual */
  public render(): void {
  }

  /** @sealed */
  public initialize(): void {
  }
}

class Child extends Base {
  /** @override */
  public render(): void;
}

See also