www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - [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
May 16 2004