I know that this = null
is illegal.
I\'m wondering if there\'s some other way to have an object clean itself up.
my desire is to be able to do some
Yes, it is possible if you reimplement GC in your applications. My answer is inspired by your discussion with Patricia, where you said you want to have all references to that object set to null. GC example:
class MyGC {
byte[100000] myMemory;
int nextFreeCell;
myNew (int value) { }
get (int myCell) { }
}
This way you can control that there are no other refernces to your class. Your class must also contain the refernces to your GC memory only. Your example:
int cell = MyGC.new(A.class)
MyGC.get(cell).doSomething();
if (MyGC.get(cell) == null)
--- true -----