[Issue 7236] New: Protected class members in different file inaccessible

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 5 14:50:24 PST 2012


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

           Summary: Protected class members in different file inaccessible
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: full.demon at gmail.com


--- Comment #0 from Taco <full.demon at gmail.com> 2012-01-05 14:50:24 PST ---
Example:

a.d:
class A
{
protected:
    void f()
    {
    }
}


main.d:
import a;

class B: A
{
public:
    void g(A a) // using g(B b) it works
    {
        a.f(); // error
    }
}

int main()
{
    auto b = new B;
    b.g(b);
}


dmd main.d a.d

Error: class a.A member f is not accessible


This is ONLY if A is in a different file (else B can access any of A its
members due to module accessibility). If g accepts B instead of A it works
though.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list