class design question (inner classes)

Regan Heath regan at netmail.co.nz
Tue Sep 11 09:32:55 PDT 2007


Regan Heath wrote:
> Of course, if you use Inner with another Outer class it will overwrite
> the static m_Outer and fail horribly...

But maybe we can get round this by using templates...

class Inner(T)
{
   static T m_Outer;
}

That way, if you use say..

Inner!(Outer) a;
Inner!(Outer) b;
Inner!(Outer) c;

Inner!(Bob) d;
Inner!(Bob) e;

Inner!(Fred) f;

You will get a static m_Outer for each combination, thus 3 for the code 
above.

Regan



More information about the Digitalmars-d mailing list