This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Non-default ctors, virtual base classes, & multiple inheritance all at once!
- To: 'sidster' <patrick at mail dot boxsoft dot com>
- Subject: RE: Non-default ctors, virtual base classes, & multiple inheritance all at once!
- From: Jan Reimers <janr at molienergy dot bc dot ca>
- Date: Wed, 6 Sep 2000 10:13:15 -0700
- Cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>, "'scherrey at switchco dot com'" <scherrey at switchco dot com>
> -----Original Message-----
> From: sidster [mailto:patrick@mail.boxsoft.com]
> Sent: Wednesday, September 06, 2000 9:33 AM
> To: Alexandre Oliva
> Cc: scherrey@switchco.com; gcc@gcc.gnu.org
> Subject: Re: Non-default ctors, virtual base classes, & multiple
> inheritance all at once!
>
> If I understand what you are suggesting correctly then it is
> _impossible_ to get the desired behavior with the given code.
>
> Since template <typename X> class HoldX has no knowledge of what
> base classes X might have to even provide constructors to specify
> them in its "mem-initializer-list".
template <typename X> class HoldX : public virtual X
{
HoldX(int) : A(int),X(int) {};
};
Now the template parameter X is required to derive from A, restricting the
utility of HoldX. But most template code places requirements on the
template parameters, STL being an example. There is nothing earth
shattering about this. Make virtual base classes abstract with no data, and
everything will work out.
JR