[comp.lang.c++] Question: indirect virtual base classes

shankar@hpclscu.HP.COM (Shankar Unni) (12/21/89)

I have a question on indirect virtual base classes:

Consider the following situation:

    class A {public: int a_mem;};
    
    class B : virtual public A {};
    
    class C : public A {};
    
    class D : public B, virtual public C {};
    


                A
	       / \
     virtual  /   \
	     /     \
	    B       C
	     \     /
	      \   /  virtual
	       \ /
	        D


Questions:

   (a) How many "A"'s are there in "D"?
   (b) If there is more than one, is the following access unambiguous, and
       if so, which "A" does it refer to:  "D::a_mem"


My copy of cfront (2.0) seems to think that:

   (a) there is only *one* A in D.
   (b) (this is therefore moot).

Given this behaviour, I have a followup question:

   Does the "virtuality" of a direct base class extend to all of *it*s
   direct and indirect base classes?

Only if this is true could cfront have created only one copy of "A" in "D".

Could someone in the know (or who can read between the lines in the AT&T
reference) give me answers to these questions?
-----
Shankar Unni                                   E-Mail: 
Hewlett-Packard California Language Lab.     Internet: shankar@hpda.hp.com
Phone : (408) 447-5797                           UUCP: ...!hplabs!hpda!shankar