I have a problem in some code I've been writing lately.
Suppose I have the following code:
Code:
class A{
public:
Vector3D* point;
};
class B{
public:
A* obj;
float computeSomething( Vector3D* point );
};
float B::computeSomething( Vector3D* point ){
Vector3D* v = someObject->getVector();
float result = *point * *v;
return result;
}
Then at some point inside a function of class B I do:
Code:
float m = computeSomething( obj->point );
My problem is, pointer obj is correctly initialized before the call to function computeSomething, meaning that it points to an instance of class A, but after the function call the pointer is NULL!
It seems that somhow the instance of class A gets erased.
Does someone know why?
Ed.