Constructors and multiple virtual inheritance -- bug or feature?
Alexandre Oliva
oliva@dcc.unicamp.br
Wed Dec 9 03:08:00 GMT 1998
On Dec 9, 1998, csk@cs.washington.edu (Craig Kaplan) wrote:
> I can understand why D needs to explicitly call A's constructor -- for
> if not, then the initialization of A is ambiguous. But it's by no means
> ambiguous for E, since E's constructor can rely on D's constructor to
> initialize the A part.
It can't. In C++, in the presence of virtual inheritance, it's always
the most derived class that must initialize all virtually-inherited
sub-objects.
> I should be able to singly inherit from any class without having to
> know about the initialization nightmares of its ancestry.
Then avoid virtual inheritance.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list