[Vala] Array of unowned objects
- From: Jiří Janoušek <janousek jiri gmail com>
- To: vala-list gnome org
- Subject: [Vala] Array of unowned objects
- Date: Wed, 30 Nov 2011 23:19:53 +0100
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]