How can I get all instances from a certain class or kill all instances of certain class?
For Example, I’ve a Class MyClass which I intantiate three times as m1, m2 and m3.
Is there a way to get or kill all these instances?
more clarification : when I’ve a “settings form” class. When the user click Settings button the application makes instance from this class. When he clicks the same button again it makes new instance. I want it show the 1st instance only and not making new instance
Not that i’m aware, but you can save the instance when constructing the object on some sort of collection so you can access all instances later:
EDIT:
Save the settings class as a field for the form, and when clicking button, check if that field is null; if so, instantiate