May 17, 2004 [Bug:] Failure to access private base type | ||||
---|---|---|---|---|
| ||||
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 |
Copyright © 1999-2021 by the D Language Foundation