Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!fernwood!lia!jgro From: jgro@lia (Jeremy Grodberg) Newsgroups: comp.lang.c++ Subject: Re: multiple inheritance bug Message-ID: <1991Feb11.213836.1840@lia> Date: 11 Feb 91 21:38:36 GMT References: <3553@island.COM> <9592@dog.ee.lbl.gov> Reply-To: jgro@lia.com (Jeremy Grodberg) Lines: 39 In article <9592@dog.ee.lbl.gov> beard@ux5.lbl.gov (Patrick C Beard) writes: >In article <3553@island.COM> lars@island.COM (Lars Nyman) writes: ># >#I have a problem with multiple inheritance using virtual base classes, and >#suspect it's a bug in the C++ compiler. > >Don't be so quick to call this a bug. It's actually a feature. C++ does >not officially support the calling of virtual functions from a constructor. You are wrong, Mr. Beard. ARM 12.7 clearly says Member functions may be called in constructors and destructors. This implies that virtual functions may be called (directly or indirectly). The function called will be the one defined in the constructor's (or destructor's) own class or its bases, but *not* any function overriding it in a derived class. [...] The effect of calling a pure virtual function directly or indirectly for the object being constructed from a constructor, except using explicit qualification, is undefined. So, Mr. Beard, you are totally wrong in saying C++ does not offically support the calling of virtual functions from a constructor. However, Mr. Nyman's example code did involve calling a pure virtual function indirectly for the object being constructed from a constructor, without explicit qualification, so he has no reason to claim his sample code should work. Also, since Mr. Nyman didn't include the output of his sample code in his posting, it is hard to know if the problem was the code not working as it should, or Mr. Nyman not understanding what the code should do. Another test, without the pure virtual function, is called for before calling this a bug. -- Jeremy Grodberg "I don't feel witty today. Don't bug me." jgro@lia.com