2011/1/4 Pavol Klačanský <[email protected]>:
> constructor cannot contain paramters? omg

if you want a parametered constructor the syntax would be:

public class xml_parser {

       private database db;

       public xml_parser (database db) {
                this.db = db;
       }
}

or

public class xml_parser {

       private database db;

       public xml_parser () {
             // constructor;
             db = SOME_DEFAULT_DB_SETTINGS;
       }

       public xml_parser.with_database (database db) {
              // constructor with parameters
                this.db = db;
       }
}


construct is a code block to run on construction not the actual
constructor for the class.

dru

>
> V Utorok, 4. január 2011 o 15:34 +0000, Dru Moore napísal(a):
>> construct is a keyword in vala for code that will be run on the class
>> construction.
>>
>> If you rename your function to construct_database(...) does it work?
>>
>> class xml_parser {
>>
>>        private database db;
>>
>>        public void construct_database (database db) {
>>                this.db = db;
>>        }
>> }
>>
>> or probably set_database(database db) would be more common.
>>
>> dru
>>
>> 2011/1/4 Pavol Klačanský <[email protected]>:
>> > but this works, I think it has something to do with "construct"
>> >
>> >
>> > class xml_parser {
>> >
>> > private database db;
>> >
>> >        public void xml_parser (database db) {
>> >                this.db = db;
>> >        }
>> >
>> > V Utorok, 4. január 2011 o 16:17 +0100, Dr. Michael Lauer napísal(a):
>> >> Welcome to the wonderful world of conflicting C-names.
>> >>
>> >> Try naming your class XmlParser (which looks better to me
>> >> anyways...)
>> >>
>> >> :M:
>> >>
>> >> _______________________________________________
>> >> vala-list mailing list
>> >> [email protected]
>> >> http://mail.gnome.org/mailman/listinfo/vala-list
>> >
>> >
>> > _______________________________________________
>> > vala-list mailing list
>> > [email protected]
>> > http://mail.gnome.org/mailman/listinfo/vala-list
>> >
>> >
>
>
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to