Oh yes. And a class in a class can access the 'parent' classes private members making it rather useful.Can I have a class within a class?
Like this :If so how do I access the methods?
Get it ?Code:public class Outer { private int _value; public Outer(int value) { _value = value; } public class Inner { public int GetOuterValue(Outer value) { // gain access to the parent classes private member variable return value._value; } } } // example code Outer.Inner inner = new Outer.Inner(); Outer outer = new Outer(100); int outerValue = inner.GetOuterValue(outer);
Darwen.




Reply With Quote