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



Hi,

2010/1/1 Dov Grobgeld <dov grobgeld gmail com>:
How do you create a "transparent" inheritance? E.g. I would like to inherit
from Gtk.RadioToolButton and support all its methods and constructors.
short answer: you cannot ;-)
Long answer, you can transparently inherit methods, but for
constructors it is more complicated : You need to explicitly write
constructors, and chain up (btw, you cannot always chain up to a
constructor, and you're not obligated to chain up to the direct base
constructor).

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?
as I explained earlier, constructors aren't inherited, you need to
explicitly write a constructor, and I think you cannot chain up to
RadioToolButton's constructor, you need to write a constructor and
chain up to Object, setting the needed property.

HTH,
Abderrahim



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