Inner classes question

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Mon Sep 11 12:31:46 PDT 2006


Jarrett Billingsley wrote:
> "Ivan Senji" <ivan.senji_REMOVE_ at _THIS__gmail.com> wrote in message 
> news:ee46qa$2frb$1 at digitaldaemon.com...
> 
>> The current workaround I'm using can hardly be called a workaround at all:
>>
>> O outerO;
>>
>> class O
>> {
>>   this()
>>   {
>>     outerO = this;
>>   }
>>
>>   class I1
>>   {
>>   }
>>   class I2
>>   {
>>     this()
>>     {
>>       I1 a = outerO.new I1;
>>     }
>>   }
>> }
>>
>> The only problem with this is that I am limited to only one instance of O 
>> this way :)
> 
> Then move outerO into O :)  Thus, outerO is initialized as the "this" for 
> each instance, and the inner classes can access outerO without the need for 
> any kind of qualification. 
> 

Thanks Jarrett! I can't believe I didn't think of that, that will work 
perfectly :)
If I had a wall nearby I would be banging my head into it for not 
thinking of that.
Thanks again!! :)



More information about the Digitalmars-d-learn mailing list