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



> From: Leslie Polzer <webmaster nachtwind net>
>
> On Sat, 22 Feb 2003 08:51:11 -0800
> rsteinke w-link net wrote:
>
> > > From: Paul Davis <paul linuxaudiosystems com>
> > > [...]
> > > class Foo : public SigC::Object { ... }
> > 
> > Actually,
> > 
> > class Foo : virtual public SigC::Object { ... };
> >             ^^^^^^^
> > Otherwise, you run into problems with multiple inheritance.
>
> What kind of problems would that be?

for example,

class A : public SigC::Object {};
class B : public SigC::Object {};

class C : public A, public B {};

C now contains two instances of SigC::Object, and
casting down through A or B reach different instances.
You only want one instance, so that whenever you cast to
SigC::Object you always get the same instance.
the 'virtual' keyword takes care of this.

Ron Steinke

"The sound of gunfire, off in the distance. I'm getting used to it now."
-- Talking Heads



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