I have a class say 'A', an object 'a' of which creates an object 'b' of class'B'. Now 'b' runs a method which wants to create a new instance of b's parent(please dont confuse it with inheritance) - the class which created 'b', which is 'A' as in here.
Is this anyhow possible in Java ? Or maybe some design suggestion may work.
Thanks !
Edit : As per suggestions, I am adding my design requirement too. I have an "ExitController" class, which works differently as per the caller function - like if it is invoked by a UserX, it terminates program, if it is invoked by a UserY it logs him off, etc. Typically I should be placing an ExitController method in my User interface, but there are some constraints due to which I cant. Also, passing the parent object/classname is seeming very expensive compared to the use it offers.