Re: [Vala] How to chain up to parent constructor



Dov Grobgeld píše v Pá 01. 01. 2010 v 12:13 +0200:
How do you create a "transparent" inheritance? E.g. I would like to inherit
from Gtk.RadioToolButton and support all its methods and constructors.

But when creating the proxy class FooRadioToolButton below I get the error
"The name `from_stock' does not exist in the context of
`FooRadioToolButton'" though from_stock exists in Gtk.RadioToolButton. What
did I do wrong?


Constructors are never automatically inherited (it wouldn't make much
sense in most cases, don't you think?). You need to chain it up
yourself.

Example:

public class FooRadioToolButton : Gtk.RadioToolButton {
        public FooRadioToolButton.from_stock (SList<Gtk.Widget> list,
StockWhatever stock) {
                base.from_stock (list, stock);  
        }
}


Thanks!
Dov


You're welcome :)

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy



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