http://d.puremagic.com/issues/show_bug.cgi?id=2563

           Summary: Derived class is implicitly castable to Base class when
                    inherited privately
           Product: D
           Version: 2.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: 2kor...@gmail.com


module A;

class A1
{
    void foo();
}

class A2 : private A1
{
}

module B;

void main() {
    A2 a2 = new A2();
    // a2.foo(); // Error: class A.A2 member foo is not accessible

    A1 a1 = a2;  // This line should yield an error
    a1.foo();    // ta-dam! Private method invoked
}


-- 

Reply via email to