The code that I want to use is
private void removeInstance (BaseClass b) {
    // some more code
    b = null;
}
b can be of an instance of a subclass of BaseClass. For example
public class C extends BaseClass {/* Some Code */}
This is what should be possible.
C c = new C ();
// some code
removeInstance (c);
However it currently does not set c to null as c is cast to BaseClass in this example.
I want to be able to set an instance to null from the base class in one way or another.
 
     
    