[Vala] About Translating Vala Tutorial



Hi:
i'm try to translating the Vala Tutorial ( https://live.gnome.org/Vala/Tutorial#Generics ) into chinese.

i have been translated into Chapter 4

    i have two questions:

    1) in section about structs, the Tutorial said **:

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

        but i write following code like :

        struct STest {

                private int member;
        }

        static int main() {

                STest s = STest ();

                s.member = 1;

                return 0;
        }

there was no any errors hint when build the code, but in c#, it should error

        i want to know, if it is a bug, or not support actually


    2) in section about gobject - style construction, the Tutorial said :

Construct properties are defined just as get and set properties, and therefore can run arbitrary code on assignment. If you need to do initialisation based on a single construct property, it is possible to write a custom construct block for the property, which will be executed immediately on assignment, and before any other construction code.

there is no example about this feature, i don't know how to do this , and in my mind, the construct block is execute after then property construction, except the static construct block, but it would not
        conform this clearly.

        i want a example, thank you


Thank you for your reply, and best regards to you! at last sorry my bad english....



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