abstract base classes & MI

Mike Stump mrs@wrs.com
Fri Feb 19 16:35:00 GMT 1999


> Date: Fri, 19 Feb 1999 16:03:56 -0600
> From: Charles Kerr <ckerr@enterprise.nssl.noaa.gov>
> To: egcs@egcs.cygnus.com, egcs-bugs@egcs.cygnus.com

> Using egcs-2.93.06 (the 1999/02/08 snapshot), the code:

>      struct A_interface {
>         virtual void foo ( ) = 0;
>      };
>      struct A_impl {
>         virtual void foo ( );
>      };
>      struct B_interface: public A_interface {
>         virtual void bar ( ) = 0;
>      };
>      struct B_impl : public A_impl, public B_interface {
>         virtual void bar ( );
>      };
>      struct C: public B_impl {
>         void asdf ( ) {
>            foo ( );
>         }
>      };

> yields the error:

>      Foo.C: In method `void C::asdf()':
>      Foo.C:15: request for member `foo' is ambiguous in multiple inheritance lattice

> I don't see the ambiguity.

Let me explan on what others have said some...

Which subobject did you want the virtual foo valled with?  A_impl or
a_interface?  How does the code indicate that?  (It doesn't.)  Put in
a virtual base for A_impl and A_interface and link A_impl to
A_interface and it'll work as written.


More information about the Gcc-bugs mailing list