You must use container objects. That is, an object containing a reference to the objx object. The simplest container object will be an array of one element, but it is an extremely ugly and error prone solution.
Note that for brevity, I did not use access methods. Usually you should not use direct member access, as here.
public class ObjxContainer {
public Objx objx;
}
...
ObjxContainer o1;
ObjxContainer o2;
ObjxContainer o3;
ObjxContainer[] arr = new ObjxContainer[] { o1, o2, o3 };
Now access to objx in ObjxContainer will have the desired effect:
arr[0].objx = new Objx();
source
share