Using closure in function scope to make "real" private class members
Commander Zot
no at no.no
Sat Jun 4 13:37:18 UTC 2022
On Friday, 3 June 2022 at 12:06:01 UTC, zjh wrote:
> 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.
it adds more special cases to metaprogramming for practically no
benefit.
More information about the Digitalmars-d
mailing list