haxeAbstracts


Syntax

  • abstract identifier(underyling type) { ... }
  • abstract identifier(underlying type) from typeA from typeB ... to typeA to typeB { ... }

Remarks

An abstract type is a compile-time type which resolves to the underlying type at run-time. This means that thee abstract type does not exist in the source code generated by the Haxe compiler. In its stead are placed the underlying type, or types defined for implicit casting.

Abstracts are denoted by the abstract keyword, followed by an identifier, and underlying type in parentheses.

Abstracts may only define method fields and non-physical property fields. Non-inlined method fields are declared as static functions in a private implementation class, accepting as an additional first argument the underlying type of the abstract.

Note that operator overloading is only possible for abstract types.