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

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun Jun 5 19:48:03 UTC 2022


On Sunday, 5 June 2022 at 19:41:36 UTC, Dom Disc wrote:
> Anybody can declare friends, without even touching the file 
> where the class is defined, and thereby access things that 
> shouldn't even be visible to them (implementation details or 
> even security relevant things)!

No, I don't think so:

«If a program contains more than one definition of a type, then 
each definition must be equivalent.»

https://en.wikipedia.org/wiki/One_Definition_Rule

Whether compiler check for it, or not, is another issue.



More information about the Digitalmars-d mailing list