Hi All,
I fail to compile the following code (well, not exactly that code...):
class BB
{
};
class B
{
public:
static B* Create(int i);
};
class D0 : public BB, B
{
};
class D1 : public BB, B
{
};
B* B::Create(int i)
{
if (i == 0)
return new D0();
else
return new D1();
}
int main()
{
B *b = B::Create(1);
delete b;
return 0;
}
And get: "error: 'B' is an inaccessible base of 'D0', 'B'
is an inaccessible base of 'D1' "
But when I change the order of inheritance: "class D0 : public B, BB",
everything works fine.
Why?
TID, Yuval.