Re: [Vala] Structure initialisation syntax
- From: James Moschou <james moschou gmail com>
- To: vala-list gnome org
- Subject: Re: [Vala] Structure initialisation syntax
- Date: Wed, 27 Apr 2011 11:04:12 +0930
On 27 April 2011 08:46, David Given <dg cowlark com> wrote:
On 26/04/11 23:02, Sébastien Wilmet wrote:
[...]
Color c = Color ();
c.red = 0.5;
Sorry, it's late and I forgot a magic key phrase: I'm actually looking
for a designated initialiser, where I get to specify individual field
names and values inside the initialiser block.
--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "I have a mind like a steel trap. It's rusty and full of dead mice."
│ --- Anonymous, on rasfc
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
If it's a struct you've defined you can do what I do and define the
initialiser yourself
public struct Range {
public uint position;
public uint length;
public Range (uint _position, uint _length) {
position = _position;
length = _length;
}
}
Range range = Range (0, 10);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]