vala-code icon indicating copy to clipboard operation
vala-code copied to clipboard

Construct gobject field

Open gavr123456789 opened this issue 5 years ago • 0 comments

Problem:
image

Code:

public class Person : Object {

    /* Construction properties */
    public string name { get; construct; }
    public int age { get; construct set; }

    public Person(string name) {
        Object(name: name);
    }

    public Person.with_age(string name, int years) {
        Object(name: name, age: years);
    }

    construct {
        // do anything else
        stdout.printf("Welcome %s\n", this.name);
    }
}

gavr123456789 avatar Sep 07 '19 17:09 gavr123456789