Re: [Vala] how to call the base class constructor



picca wrote:
so how can I call the base constructor and more generaly a Base class
method ?

Hi,

the base constructor gets called implicitly. If you have construction
parameters you have to set them explicitly in the child class:


public class Base : Object {
    public string name { private get; construct; }

    public Base (string name) {
        this.name = name;
    }

    construct {
        // Base construction code
    }
}

public class Child : Base {
    public Child (string name) {
        this.name = name;
    }

    construct {    // base construction code gets called implicitly
        // Child construction code
    }
}



Regards,

Frederik



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]