c++ - [Bug:] Failure to access private base type
- Matthew (33/33) May 16 2004 class Base
class Base { }; class Derived : private Base { public: Base &get_base_type(); Base const &get_base_type() const; }; int main() { Derived d; Base &b = d.get_base_type(); return 0; } Base &Derived::get_base_type() { return *this; } Base const &Derived::get_base_type() const { return *this; } Gives H:\Dev\Test\compiler\dmc\privbase>dmc privbase.cpp return *this; ^ privbase.cpp(24) : Error: member 'Base' of class 'Derived' is not accessible return *this; ^ privbase.cpp(29) : Error: member 'Base' of class 'Derived' is not accessible --- errorlevel 1
May 16 2004