Why no acess to other structs in classes?

Bill Baxter dnewsgroup at billbaxter.com
Mon Nov 6 15:28:53 PST 2006


Karen Lanrap wrote:
> Mariano wrote:
> 
>> This seams like really bad practice. A function inside a struct
>> returning something from outside itself?
> 
> If it is bad practice, then why it is supported on the module level?

It's also exactly the kind of thing iterators are going to have to do.

class C
{

   class MyIterator {
      int get() {
         return .outer.array[i];
      }
      ...
      size_t i=0;
   }

   int[] array;
}

--bb



More information about the Digitalmars-d-learn mailing list