S
Stefan Weber
Hi,
I have the following header file (named test.h):
class Foo
{
public:
Foo(void) {}
virtual ~Foo(void) {}
};
class Bar : public Foo
{
public:
Bar(void) {}
virtual ~Bar(void) {}
};
with a very simple cpp file:
#include "test.h"
int main() {
Foo* f = new Bar();
}
This compiles with Visual Studio 2005, but with g++ 4.1.1 I get an
error:
bash-3.00$ test.cpp:4: error: Foo is an inaccessible base of Bar
Acutally, I know that this error message occurs when doing something
like "class Bar : private Foo" (i.e. inherit the code but withouth
polymorphism). But I obviously declared to use public inheritance.
Does anybody see the problem?
Thanks,
Stefan
I have the following header file (named test.h):
class Foo
{
public:
Foo(void) {}
virtual ~Foo(void) {}
};
class Bar : public Foo
{
public:
Bar(void) {}
virtual ~Bar(void) {}
};
with a very simple cpp file:
#include "test.h"
int main() {
Foo* f = new Bar();
}
This compiles with Visual Studio 2005, but with g++ 4.1.1 I get an
error:
bash-3.00$ test.cpp:4: error: Foo is an inaccessible base of Bar
Acutally, I know that this error message occurs when doing something
like "class Bar : private Foo" (i.e. inherit the code but withouth
polymorphism). But I obviously declared to use public inheritance.
Does anybody see the problem?
Thanks,
Stefan