From: dave@boostpro.com   
      
   on Sat Mar 31 2012, Ivan Godard wrote:   
      
   > The goal here is that the X1 hierarchy should be topologically the same   
   > as the X0 hierarchy, but with a few added members at each level. The   
   > desired inheritance graph looks like a ladder:   
   > A0 <- A1   
   > ^ ^   
   > B0 <- B1   
   > ^ ^   
   > C0 <- C1   
   >   
      
   ....   
      
   > Essentially I am trying to derive a whole inheritance graph from another   
   > whole inheritance graph, rather than deriving a single class from   
   > another single class.   
      
   ....without repeating any bases and without using virtual inheritance in   
   the original inheritance graph.   
      
   > I expected that deriving from a virtual base class would implicitly   
   > make all the bases of the virtual base be also virtual; apparently   
   > not.   
   >   
   > Is there any way to do this?   
      
   Not using virtual inheritance. You may need to step further back and   
   describe what your actual constraints and goals are, rather than   
   assuming that derivation is the way to handle it... if there's a way at all.   
      
   > If not, why was inheritance from a virtual base defined this way?   
      
   Because virtual bases have a cost and they alter the layout of the   
   class, the working of its constructors, etc. The layout of B0 is   
   already determined and it's too late to change the part of its   
   definition that would enable it to share an A0 with A1.   
      
   --   
   Dave Abrahams   
   BoostPro Computing   
   http://www.boostpro.com   
      
      
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|