I have following code:
class B{
protected:
X *x;
public:
function(char *data){
// access x
// works fine
}
};
class D: public B {
function2(char *data)
{
// access x
// gets garbage
}
};
I have a member variable which is pointer. moreover this pointer is inside "data" but when i access in class D it shows garbage.
can some body please help me…
I’ve put on my psychic debugging hat, and come to the conclusion you’re probably doing something like this:
Am I right?
If so, my guess is that the
Gizmoyou’re pointing to has somehow fallen out of scope — thereby becoming destroyed — or you performed the cast incorrectly.