Question about the interface classes

Matthias Kretz kretz at kde.org
Mon Jun 25 10:01:53 CEST 2007


On Monday 25 June 2007, Richard wrote:
> > a) EffectInterface inherits QObject, VolumeFaderEffectInterface
> > inherits
> > QObject
> > => obviously doesn't work because a VolumeFaderEffect
> > implementation would
> > have to inherit both EffectInterface and VolumeFaderEffectInterface
>
> Just wanted to shoot in, if I understand the problem correctly, that you
> can solve this by using virtual base classes. If you e.g. specify:
> class A;
> class B : public virtual A
> class C : public virtual A
> class D : public B, public C
>
> Then instances of D will only allocate one version of A.
> Personally I feel that such a solution is messy, tough.... :)

Yes, I've been doing that. And I've come to the conclusion (as I had 
before): "avoid virtual inheritance if you can".

The big problem in this case is QObject. You always have to inherit from 
QObject first.

class B : public virtual QObject
class C : public virtual QObject

So far it's ok.

class D : public B

Still ok, but

class D : public B, public C

no go. :-(

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/phonon-backends/attachments/20070625/2008d8d4/attachment.pgp 


More information about the Phonon-backends mailing list