Image

Imageunicron83 wrote in Imagecpp

Help

p->getValue( ).setW(1);

cout << p->getValue( ).getW( );

 


Output is "0".


Ok, so I have this function which I want to update a value in an object. 
The object is stored in a linked list represented by the pointer p.  The
function getValue( ) merely returns a particular object in the list.  The
function setW(int a) merely sets a value, w, of the object to whatever integer
is passed to the function.  getW( ) merely returns is supposed to return
the integer value of w in the object.  I know the value got passed into the
setW function and w was set to 1 (when I output w from the setW(int a) function
itself, i got 1).  When I output w from this function, I get 0!  What
am i missing?  Any help would be appreciated.