Re: [Vala] initializing structures
- From: "Cliff Brake" <cliff brake gmail com>
- To: vala-list gnome org
- Subject: Re: [Vala] initializing structures
- Date: Thu, 4 Sep 2008 11:08:36 -0400
more fun with structure initialization ....
I can't figure out how to initialize a structure that is class scope.
Does anyone have suggestions how to do this, or another way to
accomplish this?
using GLib;
public struct mystruct {
public string test1;
public int test2;
}
public class TestStruct : Object {
public mystruct ms;
public mystruct[] ms_array;
public void init()
{
ms = mystruct() {test1="this is a test", test2=10};
/* the following does not compile */
ms_array = {
mystruct() {test1="this is a test", test2=10},
mystruct() {test1="this is a test", test2=20}
};
/* the following works */
mystruct[] ms_array2 = {
mystruct() {test1="this is a test", test2=10},
mystruct() {test1="this is a test", test2=20}
};
}
}
--
=======================
Cliff Brake
http://bec-systems.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]