E 
		
								
				
				
			
		Etienne Boucher
Nested classes are usualy objects made to only live in their parent object
instance. In other words...
public class Outter
{
public class Inner
{
}
}
Prevent being able to use "new Outter.Inner()", in Main for exemple, while
still being able to access the members of Inner.
This could be done with a public interface implemented in a private nested
class, or like this:
public class Outter
{
private Inner i;
public Outter()
{
new Inner(this);
}
public class Inner
{
private Outter o;
public Inner(Outter o)
{
if (null != o.i)
throw new Exception();
o.i = this;
this.o = o;
}
}
}
But that's not very clean. Any one can think of a better way?
Etienne Boucher
				
			instance. In other words...
public class Outter
{
public class Inner
{
}
}
Prevent being able to use "new Outter.Inner()", in Main for exemple, while
still being able to access the members of Inner.
This could be done with a public interface implemented in a private nested
class, or like this:
public class Outter
{
private Inner i;
public Outter()
{
new Inner(this);
}
public class Inner
{
private Outter o;
public Inner(Outter o)
{
if (null != o.i)
throw new Exception();
o.i = this;
this.o = o;
}
}
}
But that's not very clean. Any one can think of a better way?
Etienne Boucher