Re: inherited properties



    Murray> Does something_set_property() need to handle the properties of
    Murray> the base object too? That seems silly, but I can't think how
    Murray> else those properties could be set.

    >> Can't it (or shouldn't it) just chain up to the base class if the
    >> property name isn't one of the ones it knows about?

    Murray> It doesn't seem to.

The decision whether or not to chain up to a base class is still the
programmer's job, but it should be as easy to accomplish as possible.
Otherwise you wind up with people just pasting in set_property code
from the various base classes.  I'm not familiar with Gtk's innards,
but I'll bet the person implementing, say, gtk_button_set_property,
can't blindly call the base class's set_property slot, because it
might be NULL.  Does Gtk have something akin to "call_super" the
implementer can simply call unconditionally that does the heavy
lifting?  It would walk up the class chain looking for the first
non-null copy of the slot it's interested in, then call it.

-- 
Skip Montanaro (skip pobox com)
http://www.mojam.com/
http://www.musi-cal.com/



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