Private Nested Classes?
Andre Pany
andre at s-e-a-p.de
Sun Mar 31 20:35:49 UTC 2019
On Sunday, 31 March 2019 at 20:23:55 UTC, Vasyl Teliman wrote:
> On Sunday, 31 March 2019 at 20:07:39 UTC, D Man wrote:
>> Is it possible to have private inner nested classes?
>>
>> For example if I have a class that is only ever used inside
>> another class, it would make sense to be able to 'lock' it
>> inside the outer class, so that raw instances of it cannot be
>> created.
>>
>> But in this example: https://run.dlang.io/is/PfemUV
>>
>> The `private` specifier seems to have no meaning.
>>
>> Is there a way to get the desired effect (make a nested class
>> only accessable from within it's outer class)?
>
> Not sure but this looks like a bug.
Private works on module level, not on class level. The inner
class is not accessible from other modules but from the own
module.
Kind regards
Andre
More information about the Digitalmars-d
mailing list