F
fred
Hi, can someone please explain to me how a static member of a class works.
For example if I have:
public Class1
public static Class2 myClass2 = new Class2;
public static Int16 thisValue = 200;
public static string thisString = "This string value";
public static boolean thisBool = True
....
if Class1 is never instantiated what value do these variables take on and
exactly when do they get these values? In other words when is Class2
instantiated?
If Class1 is instantiated and then terminated what value do these variables
have. Do the variables have their values restored immediately after the
termination of the Class1 object or does it wait for GC?
Thanks,
Fred
For example if I have:
public Class1
public static Class2 myClass2 = new Class2;
public static Int16 thisValue = 200;
public static string thisString = "This string value";
public static boolean thisBool = True
....
if Class1 is never instantiated what value do these variables take on and
exactly when do they get these values? In other words when is Class2
instantiated?
If Class1 is instantiated and then terminated what value do these variables
have. Do the variables have their values restored immediately after the
termination of the Class1 object or does it wait for GC?
Thanks,
Fred