Inner classes question

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Sep 11 12:23:34 PDT 2006


"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. 





More information about the Digitalmars-d-learn mailing list