Method of another module is callable, even if they is private.

Namespace rswhite4 at googlemail.com
Sat Oct 12 12:23:17 PDT 2013


On Saturday, 12 October 2013 at 19:07:44 UTC, Andrej Mitrovic 
wrote:
> On 10/12/13, Namespace <rswhite4 at googlemail.com> wrote:
>> Bug or feature? :P
>
> Has to be a bug. Reduced:
>
> -----
> module a;
> import b;
>
> void main()
> {
>     auto s = S();
>     auto f = &s.f;  // no error
>     f();  // no error
>
>     auto sf = &S.sf;  // error
> }
> -----
>
> -----
> module b;
> struct S
> {
>     private void f() { }
>     private static void sf() { }
> }
> -----

Ok, I've opened a bug report for this.
Otherwise it would be a nice C++-friend like feature. :D Of 
course, a bit protection would be needed.


More information about the Digitalmars-d-learn mailing list