Re: [Vala] Chaining up constructors.



On Sun, 2008-11-23 at 05:07 -0500, Yu Feng wrote:
On Sun, 2008-11-23 at 11:00 +0100, Jürg Billeter wrote:
On Sun, 2008-11-23 at 04:53 -0500, Yu Feng wrote:
On Sun, 2008-11-23 at 10:03 +0100, Jürg Billeter wrote:
On Sun, 2008-11-23 at 00:13 -0500, Yu Feng wrote:
Both vala 0.5.1 and trunk fails to smoothly switching the parent
classes. if I have extra stuff in the creation methods.

Do you have an example or bugzilla link?

I was experiencing the problem with that piece of DOM project. this is
an abridged version:

class AAA: Object {


    public AAA() {
        int i = 10;
    }
}
class BBB: AAA {

    public int j {get; construct;}
    public BBB() {
        base();
        j = 100;
    }
}

You should use "private set" here instead of "construct" with the new
construction scheme. This shouldn't cause any issues.

The situation is:
(1) I need j to be a construct property because the object eventually is
going to be created with g_object_new.

What's the reason that you use g_object_new to create the object?

Would it be possible to create the object with default values first and
set the properties later?

Jürg




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