Why do private member variables behaved like protected in the same module when creating deriving class?

unprotected-entity unprotected-entity at unprotected-entity.gmail.com
Mon Oct 29 05:13:08 UTC 2018


On Sunday, 28 October 2018 at 11:32:07 UTC, Mike Parker wrote:
>
> In D, the module is the unit of encapsulation, not the class.

Again. this is not entirely correct.

-----
class Foo { private int i; }

void main()
{
  {Foo f;}
  f.i++;
}

----

It's really hard to have a converstation when posts are being 
checked by 'someone', at 'their leisure', before (or if) they 
ever get posted??




More information about the Digitalmars-d mailing list