This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

Back to Vala Reference Manual

Structs

A struct is a data type that can contain fields, constants, and methods.

The simplest struct declaration looks like this:

struct StructName {
        int some_field;
}

A struct must have at least one field, except in either one of the following cases:

Struct declaration

If a super-struct is given, the struct-name becomes an alias for that struct.

Controlling instantiation

Unlike in a class, any code can go in this method.

Struct fields

Documentation

Struct constants

Struct methods

See Methods, See Classes/Class methods

Examples

Demonstrating...

// ...


2024-10-23 11:37