haxe Abstracts

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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.



Got any haxe Question?