Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!wasatch!mailrus!ulowell!masscomp!guest From: guest@masscomp.UUCP (Mr Guest) Newsgroups: comp.lang.c++ Subject: constructors for virtual base classes Message-ID: <1429@masscomp.UUCP> Date: 5 Jul 89 16:26:08 GMT Reply-To: loepere@westford.ccur.com (Keith Loepere) Organization: MASSCOMP - Westford, Ma Lines: 30 Consider the following template for a set of classes involving virtual base classes with constructors. class common { common () {} }; class virtual_1 : virtual public common { virtual_1 () : common () {} }; class virtual_2 : virtual public common { virtual_2 () : common () {} }; Each of the two classes derived from common has their own constructor which "call" the constructor for their base class. Now derive a class from both of these: class both : public virtual_1, public virtual_2 { both () : virtual_1 (), virtual_2 () {} }; It seems to me that the constructor for "common" will be called twice. What am I doing wrong? - Keith