[C++-sig] ‘Base’ is an inaccessible base of ‘Derived’ ??
Anders Wallin
anders.e.e.wallin at gmail.com
Sun Mar 14 22:37:15 CET 2010
Thanks, inserting a few "public" keywords here and there makes this compile:
class Base {
public:
virtual int f(int x) = 0;
};
class Derived : public Base {
public:
int f(int x) {return 2*x;}
};
class BaseWrap : public Base, public boost::python::wrapper<Base>
{
public:
int f(int x)
{
return this->get_override("f")(x);
}
};
not sure if this is worth mentioning in the documentation, or is it
very obvious to everyone except newbies like myself... :)
> The minor but very significant difference between the tutorial code and
> yours is that the tutorial uses 'struct', while you are using 'class'. The
> effect is that in your case, all base classes are private, making them, as
> the compiler says, "inaccessible".
>
> Regards,
> Stefan
More information about the Cplusplus-sig
mailing list