Skip to content
FutureBlitz

    Install

    Learn

    Your own types

    Structs, Classes, Properties, inheritance, Enums, Interfaces, Operators, and Extend.

    A program’s own types give names to its ideas: a Point, an Account, a Status. This area covers the kinds of type FutureBlitz has and when to use each. A Struct is a value, copied when it’s assigned, for small data. A Class is a reference to one shared object, for things with an identity and a lifetime. An Enum is a fixed set of named values. An Interface says what a type can do, so code can work with any type that does it. Properties, Operators, and Extend make these types as convenient to use as the built-in ones.

    Tutorials

    1. Structs Group fields into a value type with its own constructor and Methods, and see how it's copied.
    2. Classes Make reference types with constructors, Methods, ReadOnly fields, and Statics, and see objects shared.
    3. Properties Give a type members that read like fields but run code, to check values and work them out.
    4. Inheritance Extend a Class, override its Methods, call the original with Super, and test an object's Class.
    5. Enums Name a fixed set of values, handle each in a Select that the compiler checks, and combine flags.
    6. Interfaces Say what a type can do with an Interface, implement it in several Classes, and use std.core's own.
    7. Operators on your own types Define +, -, ==, <, and indexing for your own types, so they read like built-in ones.
    8. Extend Add Methods to any type, the built-in ones included, and make an existing type implement an Interface.

    The rules behind this area are in the language reference.

    Report an issue with this page or with FutureBlitz on GitHub.