![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2005
Posts: 223
Rep Power: 4
![]() |
Nested Classes Question - Solved
Okay, so say I have the following
class TestClass
{
public string stringa
class NestedClass
{
public string stringb
}
}If I declare a variable as TestClass, can I access both the NestedClass variables and the TestClass variables, or do I need to specify both a variable for TestClass and a variable for TestClass.NestedClass? (hope that makes some sense) Last edited by Arla; Apr 7th, 2005 at 5:26 PM. Reason: Solved |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
nope. You need to actually have an instance of NestedClass within TestClass, like this:
class TestClass
{
public string stringa
class NestedClass
{
public string stringb
}
public NestedClass nc;
}tc.nc.stringb="Foo"; |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|