Quoth José Alburquerque: > On Wed, 2012-11-07 at 13:34 -0600, [email protected] wrote: > > in the context of Gtkmm, is there a rationale for preferring derivation > > over composition (or vice-versa). > > From memory, I think the examples use a combination of inheritance and > composition. For example, a lot of the examples have their own window > class that derives from Gtk::Window. That's inheritance. However, > whenever a widget class in the examples includes a declaration of a > widget that it uses in some way (maybe to form part of its own > presentation), composition is being used in that case. Both methods > have their usefulness depending on what you want to accomplish and gtkmm > supports both.
In other words, it's just figuring out whether a given object IS a thing or HAS a thing. If it IS a window, then derive from Window. If it HAS a helper widget, then it contains it. It's not limited to gtkmm, it's standard practice in object-oriented design. _______________________________________________ gtkmm-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtkmm-list
