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

zjh fqbqrr at 163.com
Mon Jun 6 00:07:53 UTC 2022


On Sunday, 5 June 2022 at 19:41:36 UTC, Dom Disc wrote:
> [...]
I usually don't use the `pointer` very much, and haven't used 
`friend`.
I'm not that complicated.
I directly expose the `'members'` . If the `'private members'` 
related to realization .They are of course `private`, avoid 
unintentional use .
Class only needs to expose a few `'functions + members'`, and 
everything is OK
Class is the smallest unit of encapsulation.
`D` but do not add it. You do not know which code has changed 
your `private variables` in the same module .
It's so interesting.

> Anybody can declare friends, without even touching the file

I don't know .I haven't use `friend'.



More information about the Digitalmars-d mailing list