Re: virtual inheritance and Glib::Interface



On Wednesday 05 April 2006 22:57, Jonathon Jongsma wrote:
> On 4/5/06, Murray Cumming <murrayc murrayc com> wrote:
> > On Wed, 2006-04-05 at 13:37 -0500, Jonathon Jongsma wrote:
> > > Just so I understand, what do you think is not true?  The fact that
> > > multiple Interface objects might be created?
> >
> > Yes. Not true, I think. Here's an attempted explanation:
> >
> > Gtk::TreeStore inherits non-virtually from TreeModel, TreeSortable,
> > TreeDragSource, and TreeDragDest
> >
> > Because each of these inherits virtually from Interface, TreeStore has
> > only one copy of Interface. That's kind out counterintuitive, but I
>
> Perhaps you misunderstood.  I was saying that these classes do NOT
> inherit virtually from Interface.  At least looking at CVS they do not
> appear to be.
>
> > It would only be useful to, for instance, inherit TreeModel virtually
> > from TreeStore and ListStore, if I was going to create classes like
> > this:
>
> Yes, I was not trying to suggest that ListStore inherit from TreeModel
> virtually, I was suggesting that since ListStore inherits from 4
> classes with a common ancestor (of which TreeModel is one), those 4
> classes should use virtual inheritance to inherit from Interface,
> which they don't appear to do.

But then if they have anything other than a default constructor you can make 
them practically unusable, because of the need to invoke the constructor from 
the most derived class.  If it doesn't matter having multiple Interface 
objects (and I do not know if it does or it doesn't) you may be better off 
leaving things as they are.

Chris




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