inner member classes in final outer class

Matti Niemenmaa see_signature at for.real.address
Sun Sep 16 08:33:23 PDT 2007


coxalan wrote:
> Bruno Medeiros Wrote:
> 
>> I was thinking the following:
>>
>>    class Outer {
>>    }
>>
>>    class Inner(alias outer) {
>>      static assert(is(outer : Outer)); // Just a check
>>    }
>>
>>    final Outer o1 = new Outer();
>>    final Outer o2 = new Outer();
>>
>>    void main() {
>>        Inner i1 = new Inner!(o1);
>>        Inner i2 = new Inner!(o1);
>>
>>        Inner i3 = new Inner!(o2);
>>        Inner i4 = new Inner!(o2);
>>    }
> 
> Thanks. That looks quite promising.
> 
> But it does not compile for me:
> test.d(12): class test.Inner(alias outer) is used as a type
> test.d(12): variable test.main.i1 voids have no value

Probably because he uses "Inner i[1234]" where he should use "Inner!(o[1234])
i[1234]". The easiest solution is to use "auto" on the left-hand side of the
assignments.

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list