Dlang and POO

Steven Schveighoffer schveiguy at gmail.com
Mon Jun 21 13:09:31 UTC 2021


On 6/21/21 6:01 AM, christophe__c wrote:
> Thanks in advance to all for your welcome and your answers.

Welcome to the community!

Just FYI, these kinds of questions should go into the [learn 
forum](https://forum.dlang.org/group/learn)

And user1234's answer is correct, D's private applies to module scope, 
not struct/class scope. The main reason is so D can avoid the `friend` 
requirements of C++.

It's also pretty reasonable, since anyone who can edit the class can 
also edit the rest of the file. However, it can make things difficult 
when proving correctness if you don't have a "one class per module" setup.

-Steve


More information about the Digitalmars-d mailing list