Is there any way to simulate this situation in C ++?
I have two objects Aand B, each of which has one attribute, for example int i; I also have one pointer popointing to an object and one pointer pipointing to an integer. I want to have an integer pointer pointing to an attribute in the current object that the pointer points to. Sort of:
po = A;
pi = po->i;
// pi points to A.i
po = B;
// now pi points to B.i
I am pretty sure that this cannot be achieved with pointers, but I want to know if there is work there for this.
Lucas source
share