[Vala] Array of unowned objects



Hi, is there any way how to create an array of unowned objects
(required by a method in a library)?

This example generates error "duplicating Foo instance, use unowned
variable or explicitly invoke copy method":

-----------------------------------

[Compact]
public class Foo{
    private static Foo foo;
    private Foo(){
    }
    public static unowned Foo create(){
        Foo.foo = new Foo();
        return foo;
    }
}

void main(){
    unowned Foo foo = Foo.create();
    Foo[] foos = { foo };
}

-----------------------------------

Thanks,

Jiří Janoušek



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