Using closure in function scope to make "real" private class members
zjh
fqbqrr at 163.com
Fri Jun 3 12:06:01 UTC 2022
On Friday, 3 June 2022 at 10:20:08 UTC, bauss wrote:
> class Foo
> {
> private class string _id; // Private to the class
> }
> class Foo
> {
> private module string _id; // Private to the module
> private int _number; // Same as "private module" since
> that's the default
> }
> ```
I think it is `worth adding`. Simply adding some code can
distinguish between `class` level and `module` level. It is very
friendly for those familiar with `C++'s` class level
encapsulation.
More information about the Digitalmars-d
mailing list