A case of forward instancing, how to know if the object were created?

I have at my prog.h file
1
2
3
4
 Class tha_class;
 ....
 private:
 Myclass *the_class;


And later at prog.cpp, I have a function that create the instance:
the_class = new Myclass;

My pro.cpp has a destructor.
I have to delete 'the_class', but only it if were created.
How to know that?

Thanks
have it point to 0. you should have all unused pointers point to 0.
unless you mean you want to know whether it was int i; the_class = &i; or the_class = new int;. well, you'll have to use a variable to mark this then.
Topic archived. No new replies allowed.