Re: [gtkmm] Slots from non-Gtk subclasses.

-----Original Message-----
From: Carl Nygard
> Umm, I think you need virtual base class anytime you derive from two
> classes that use the same base class.  The classic "diamond" inheritance
> tree shows what happens.
>             A       A(1)    A(2)
>            / \       \       /
>           B   C       B     C
>            \ /         \   /
>             D            D
> If B & C didn't inherit virtually from A, then calling B::foo propagates
> to A(1)::foo, while calling C::foo propagates to A(2)::foo.  So then
> you've got two base classes (B & C) whose ancestors (A(1) & A(2)) are
> easily in inconsistent states.  These bugs cause wierd behavior more
> often than segfaults, and it's not always clear when debugging why
> variables became inconsistent.

A good compiler will catch this bug at compile time. I know gcc 3.2 catches 
the bug.

All evolution in thought and conduct must at first appear as heresy and 
- George Bernard Shaw

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