how to make private class member private

Nick Treleaven nick at geany.org
Sat Mar 17 09:56:29 UTC 2018


On Tuesday, 13 March 2018 at 13:59:00 UTC, Steven Schveighoffer 
wrote:
> If you limit to class members, then you have to do something 
> like C++ friends, which are unnecessarily verbose.

Not if you also have a module-level visibility modifier, which 
could have been `module`.

> IMO, the module-level encapsulation is the right choice. It 
> helps with a lot of key features:
>
> 1. IFTI factory methods

Aren't these mainly because constructors can't use IFTI, unlike 
C++17, and because nullary struct constructors are banned?

> 2. unittests

Documented unittests should not be allowed to use private 
symbols, I just filed this:
https://issues.dlang.org/show_bug.cgi?id=18623


More information about the Digitalmars-d-learn mailing list