This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: two constructor copies question, again


On Nov 25, 2002, "Clint Laschkewitsch" <clintl@us.ibm.com> wrote:

> On Jan 16, 2002 Rogeleio M Serrano Jr. asked why there were two copies of a
> constructor being generated in the object file.

> Alexandre Oliva responded that one was for full-object construction and one
> was for sub-object construction.

> Could you please clarify for me what you mean by sub-object?

The base-class part of a full object is a sub-object.

> Is another constructor needed if the first class is sub-classed?

Yes, if there is virtual inheritance involved.

> And if so, why?  What is the problem being solved?

Because the C++ Standard says that it is the most-derived class that
gets to initialize all virtual sub-objects.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]