Let me respond by way of explanation. When you do the following code:
df::Object *p_obj = new df::Object();
The getPosition() call returns a Position object, and you then set the x value with setX(). This works (assuming you've written setX() properly), but does nothing to the position of the original Object. It only changed the X value of the copied (returned) Position from getPosition().
What you want is something like (shown broken into steps for clarity):
df::Position p = p_obj -> getPosition();
p_obj -> setPosition(p);
This way, you change the x-value to 5 in the copied Position object, then set the position of the Object. Make sense?
As a side note not really related to the getter/setter issue, but still a problem to watch out for ... the code:
df::Object p_obj = df::Object();
will cause problems since created object, p_obj, is not allocated out of the heap (i.e., it was not created via "new") and is instead on the stack. Thus, the object will "go away" after the function/method ends, but the game engine will still refer to it (assuming it was added to the WorldManager in the constructor). In short, all game objects in Dragonfly must be created via "new".