Check if instance of class exists
807601Feb 20 2008 — edited Feb 20 2008Hi, how is it possible to check if instance of a class exists. I can't seem to find an answer even after 'googling it'.
Scenario
I have two classes. Class A and Class B. First time i load Class A. Class A has a button that hides Class A and creates an Instance of class B and shows it. Then Class B has a button that hides class B and displays Class A. If i now press the button on Class A to navigate to Class B, it will create a new instance of the class. This is a complete waste of resources and probably against true OO.
Therefore how is possible to check if Class B has an instance already created?
A point slightly seperate which has just come to me when writing this- If Class A is the main class (contains main startup method) and i hide it, when i press the button on Class B to access A would i have to create an instance? I'm sure you do because the main method is static but would just like to re-confirm?