I have a nested class. I want to access the outer and nested classes in other class. How to access both class properties and methods and my condition is i want to create object for only one class plz provide the code snippet
-
LOL - uh, why don't you provide a bit of code so we can help you. Help me live..."plz provide the code snippet"...LOLJason Bunting– Jason Bunting2008-09-26 17:39:24 +00:00Commented Sep 26, 2008 at 17:39
-
which language? can you give a concrete example of what you're trying to achieve?VVS– VVS2008-09-26 17:39:33 +00:00Commented Sep 26, 2008 at 17:39
-
I don't think the question should be modded down, but could the poster please clarify by writing a plain language explanation of what you are trying to do?kervin– kervin2008-09-26 17:50:21 +00:00Commented Sep 26, 2008 at 17:50
Add a comment
|
4 Answers
Your question isn't very clear. However, I guess you're from a Java background. C#'s and VB's nested classes behave much different from Java's nested classes. In fact, they behave much like Java's static nested classes, i.e. they don't belong to an instance of the outer class. Therefore, instances of the inner class can't access nonstatic fields in the outer class (at least not without being given an instance explicitly).