[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Re: [gtkmm] Slots from non-Gtk subclasses.
From:       Robert Jan Schaper <r.schaper () chello ! nl>
Date:       2003-02-25 6:23:13
[Download RAW message or body]

-----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
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic