Your code can be simplified:
class A
{};
class B : public A
{};
class Foo
: public B
, public A
{};
Here the Foo
class has two A
base classes
- one indirect base class
A
namedFoo::B::A
- a direct base class
A
that you cannot name in C++
You will be able get the B::A
base class subobject of a Foo
object:
Foo f;
B &b = f;
A &a = b;
but not the other A
impossible-to-name base class subobject.
You created an ambiguous inheritance situation.
Conclusion: do not do that.
Also: I really have no idea what you were really trying to do.