I'm sure this has been answered before but two hours of searching and
reading hasn't answered this question for me.
Here's a test program:
********************************
class base
{
public:
};
class der : protected base
{
public:
der()
{
}
der(char* x,const base& thing)
{
}
};
main()
{
der d1;
der d2("xx",d1);
}
********************************
The GCC compiler rightly says:
x.cpp: In function `int main ()':
x.cpp:21: fields of `base' are inaccessible in `der' due to private
inheritance
But, now I add the following methods to "der":
operator base&()
{
return (*this);
}
operator const base&() const
{
return (*this);
}
and the compiler still complains with the same error.
I've given 'der' explicit conversion operator overloads and the compiler
doesn't seem to see them.
Can some explain this, please?
TIA