vala

Classes

Introduction#

Vala support various flavours of classes.

Remarks#

Both glib-2.0 and gobject-2.0 dependencies are required unless --nostdpkg is explicitly given.

GObject Class

public class Foo : Object {
    public string prop { construct; get; }
}

It is meant for interospectable API using GObject Introspection. This is the recommended way for declaring classes.

Plain Class

public class Foo {
    public string prop { construct; get; }
}

Pure-Vala and lightweight class. This is useful if you need a compromise between efficiency of a struct and the feature of a full blown GObject class.

Compact Class

[Compact]
public class Foo {
    public string prop;
}

It is mainly used for writing bindings with specific memory management.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow