Using closure in function scope to make "real" private class members
forkit
forkit at gmail.com
Mon Jun 6 00:33:30 UTC 2022
On Monday, 6 June 2022 at 00:07:53 UTC, zjh wrote:
> 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'.
Well, if you use D, then you do ;-)
Cause the module is the friend you will always have, no matter
what ;-)
More information about the Digitalmars-d
mailing list