[Vala] private not valid or support in struct ?



hi, all:

i'm reading the Vala
Tutoria(https://live.gnome.org/Vala/Tutorial#Structs) to learn vala

the tutiria mentioned in struct section:
A Vala struct may have methods in a limited way and also may have
private members, meaning the explicit public access modifier is required

i test it with following codes:

struct Color
{
private int red;
}

static int main()
{
var c = Color();

c.red = 1; //here it can access the member directly

stdout.printf("c.red = %d", c.red);

return 0;
}

it is compiled successed.....its beyond my expectations! Sorry for my
bad english.....



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