Weird pointer problem (C++)

mikeblas

[H]ard|DCer of the Month - May 2006
Joined
Jun 26, 2004
Messages
12,776
Why not leave your post up with the eventual solution so that it can help others?
 
Joined
Jul 8, 2001
Messages
610
It wasn't really a problem that needed a solution it was me being dumb and copying and pasting code without being careful enough.

Basically I had a method of a class which was supposed to assign a value to a member variable (which happened to be a pointer) but I had unknowingly declared a local variable/pointer with the same name and type (it was actually left there from a previous implementation of some similar code) and so the code was working fine but it was only using the local pointer and I couldn't figure out why within the method the pointer was getting a value but as soon as the function returned it was back to NULL.
 
Top