On Tue, 23 Sep 2008 00:12:35 +0200
"Nicolò Chieffo" <[EMAIL PROTECTED]> wrote:

> Is it possible to declare multiple constructors for the same class (of
> course with different parameter types/number)?
> It seems I'm not able to do it, since valac complains.
> why? is this a glib limitation?

Declaring multiple constructor is possible; the Gtk.Button class, for
example, has four different constructors:

    public Button ();
    public Button.from_stock (string stock_id);
    public Button.with_label (string label);
    public Button.with_mnemonic (string label);

This unusual naming scheme is needed since C (the target language of Vala)
cannot cope with polymorphic functions. This convention is used thorough
GLib and GLib-based libraries to work around this limitation.

-- 
Andrea Bolognani <[EMAIL PROTECTED]>
Resistance is futile, you will be garbage collected.

Attachment: pgpvzQrp3Rj5q.pgp
Description: PGP signature

_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to