Re: [gtkmm] Slots from non-Gtk subclasses.
- From: Robert Jan Schaper <r schaper chello nl>
- To: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Slots from non-Gtk subclasses.
- Date: Tue, 25 Feb 2003 07:23:13 +0100
-----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
misconduct.
- George Bernard Shaw
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]