Skip to content

Inherits

Paul Squires edited this page Nov 7, 2026 · 1 revision

Home › Interfaces › Inherits

Inherits

Names a class's base class, or the interfaces an interface includes.

Syntax

class name
    inherits base_class
    ...
end class

interface name
    inherits base_interface [ , base_interface ... ]
    ...
end interface

Description

inherits is a line at the top of a Class or Interface body. It comes before any member (TKO0435) and, in a class, before the implements lines.

In a class it names the one base class: a class, or a type that extends object. The class starts as a complete object of the base and adds to it, exactly as type D extends B does, and base( … ) in a constructor chooses which base constructor runs. A class with no inherits line extends object. A second base is an error (TKO0427).

In an interface it names other interfaces, as many as needed, on one line or several. Their members become members of this interface, a type that implements it implements them too, and a value of it converts to any of them implicitly. An interface that reaches itself through its inherits lines is an error (TKO1008).

The example on the Class page has a class inheriting a class; the one on the Interface page has an interface inheriting an interface.

Remarks

  • A type names its base with extends on its header; inherits in a type body is an error that says so (TKO0433). A class names its base with inherits; extends on a class's header is TKO0432.
  • inherits is recognised only as the first word of a line in a class or interface body. Elsewhere it is an ordinary name.

See also


Category: Interfaces Kind: keyword

Clone this wiki locally