Focus

Walter Bright newshound2 at digitalmars.com
Fri Jan 18 17:35:59 PST 2013


On 1/18/2013 4:55 PM, Andrey wrote:
> Are nested classes quite more perfectly suited for this? In my containers I
> implement iterator interface using nested class. Then I can easily construct
> mycontainer.new Iterator and have (should have by theory) access to protected
> (not private) members. Also I will be ensured that this is a proper iterator and
> that it can be constructed only when I have the instantiated parent container.
>
> And after that D forces you to restrict access not via default language
> construct, but via having one declaration per file. I think this is a not
> correct. In OOP concept you don't have such thing as a file or module. There are
> no files, there is ONE program with multiple data structures and hierarchies,
> united under one super root. Well, at least, that is how this supposed to work
> from the start.

This all falls apart once you decide you need "friend" access.



More information about the Digitalmars-d mailing list