Using closure in function scope to make "real" private class members

Walter Bright newshound2 at digitalmars.com
Wed Jun 8 18:53:35 UTC 2022


My experience with C++ and the "friend" class concept is it is necessary for C++ 
because it has no notion of a module.

D is much simplified by making the module the fence for encapsulation. C++ 
favors a smaller number of large files, D is designed around a larger number of 
small files.

I understand that you don't prefer that approach, but I suspect if you've used 
"friend" classes much in C++ you'd change your mind. Most people find D's way a 
relief.


More information about the Digitalmars-d mailing list