I have this in my main:
Code:int main(){ MyClass* myObject = NULL; function1(myObject); function2(myObject); return 0; } void function1(void* param){ MyClass* myObject = (MyClass*) param; myObject = new MyClass(); //Do some stuff that requires that MyClass* } void function2(void* param){ MyClass* myObject = (MyClass*) param; //Do some stuff that require that MyClass* delete myObject; }
It hangs when I do that "stuff" in the second function. Of course this isn't my actual code, but it is what I want to achieve. I need to have a pointer to a certain object, that has to be created on one function and destroyed on another.