[omniORB] Ambiguous inheritance error

Thomas Thomas@Twinspark.nl
Wed, 24 Feb 1999 15:03:48 +0100


No, the classes and inheritance schema where correct, it just was that if I 
wrote

 class C_i : public virtual A_i, public virtual B_i, public virtual _sk_C
 {} ;

I got the ambiguos method bla bla error and if I wrote (and write)

 class C_i : public virtual _sk_C, public virtual A_i, public virtual B_i
 {} ;

I didn't. It shouldn't make a difference and is a bug and seeing that it 
solved the problem for me with the borland compiler. The problem only 
occures if the dominance rule applies over a span of more than two base 
classes. I can write, without a problem, something like:

 class B_i : public virtual A_i, public virtual _sk_B
 {} ;

I wondered if putting the dominant class first in the list it would solve 
the same problem with VC5.0.
I think the schema looks something like this.

        base
	/\ \
      _A _B \
      / \/ \ |
     /  /\  ||
    A  B  \ ||
    \  \   \||
     \  \   _C
      \  | /
       \ |/
         C

The trouble making methods are declared in _A,_B and _C , according to this 
schema, due to dominance, the implementation in _C should override the ones 
in _A and _B (read _sk_ for _).

Regs,

Thomas.
-----Original Message-----
From:	bjornw@fairplay.no [SMTP:bjornw@fairplay.no]
Sent:	Wednesday, February 24, 1999 2:28 PM
To:	Thomas@Twinspark.nl
Cc:	Omniorb Mail List (E-mail)
Subject:	Re: [omniORB] Ambiguous inheritance error

 Thomas <Thomas@Twinspark.nl> writes:

> Interesting, I run into the same problem using an other compiler 
(borland)
> with omni version 2.6.1.
> If the situation is the same as with 2.6.1 then not compiling your code 
is
> a compiler error, it should via the dominance rule choose for the
> implementation in _sk_C. A strange workaround for the same problem with 
the
> borland compiler was to place the _sk_C base class *first* in the base
> class list.
> So you would get:
>
> class C_i : public virtual _sk_C, public virtual A_i, public virtual B_i
> {} ;
>
Maybe some of the other classes 'forgot' to put the virtual in front of
the inheritance declaration. That might explain why it did not work:


         BASE           BASE
        /   \            |
DERIVED_1   DERIVED_2  DERIVED_3
     \        |         /
      \       |        /
       \      |       /
        \     |      /
          YOUR_CLASS


bjornw>