Weird pointer problem (C++)

Why not leave your post up with the eventual solution so that it can help others?
 
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.
 
Back
Top