Inner classes question

David Medlock noone at nowhere.com
Mon Sep 11 05:13:03 PDT 2006


Ivan Senji wrote:
> Steve Horne wrote:
> 
>> On Sun, 10 Sep 2006 13:11:47 +0200, Ivan Senji
>> <ivan.senji_REMOVE_ at _THIS__gmail.com> wrote:
>>
>>> I2 doesn't have a base class, so that wouldn't work.
>>
>>
>> Yeah, I'm confusing myself.
>>
>> The problem, I suspect, is putting 'new' in an initialiser. If it was
>> in a (dynamic) method, 
> 
> 
> Sorry (a bug in my example, but it doesn't change anything)
> 
> class O
> {
>   class I1
>   {
>   }
>   class I2
>   {
>     this()
>     {
>       I1 a = new I1; //line 10 -> same error
>     }
>   }
> }
> 
>> the standard route to the outer-class instance
>> would apply so it should just work, unless I'm missing something.
> 
> 
> That is what I would expect too but it doesn't happen (so we are both 
> missing something)
> 
> 

Make I1 static?  This compiles, though I am not sure if it does the same 
thing as Java.




More information about the Digitalmars-d-learn mailing list