static struct definition

monarch_dodra monarchdodra at gmail.com
Tue Aug 28 03:10:47 PDT 2012


On Monday, 27 August 2012 at 18:53:23 UTC, bearophile wrote:
> Andrej Mitrovic:
>
>> Isn't this limited to just classes?
>
> See the last section of this page:
> http://dlang.org/struct.html
>
>>Nested Structs: A nested struct is a struct that is declared 
>>inside the scope of a function or a templated struct that has 
>>aliases to local functions as a template argument. Nested 
>>structs have member functions. It has access to the context of 
>>its enclosing scope (via an added hidden field).<
>
> Bye,
> bearophile

 From TDPL: 7.18:

"Unlike classes nested within classes, nested structs and nested 
classes within
structs don’t contain any hidden member outer—there is no 
special code generated.
The main design goal of nesting such types is to enforce the 
desired access control."

I suppose this has become obsolete then?
    ...Or is it the other way around?


More information about the Digitalmars-d-learn mailing list