So basically I have an object created that is stored in the heap (using new to create it) and this object holds a pointer of a variable (Vector3 in this case, but it doesn't matter) that is stored in the stack (created using Vector3(0, 0, 0)).
I am passing the pointer to the Vector3 stored in the stack like so:
new AudioSource(some other stuff, &(e1->getPosition()))
e1 is another pointer to an object in the heap, but I don't think it matters.
So I assume that when I update the position (for example e1->setPosition(something) then since the object that I want to keep a pointer of this position has the pointer and not a copy of the position, it should automatically hold the new values that are stored in that memory address.
However, that is not the case. I update the position of the object that has it, but it isn't updated in my other object that holds the pointer.
Could it be because position is stored in the stack?
Thank you for reading, sorry if you didn't understand something.