[Qt-interest] global variables new and delete

Serge mb0 at km.ru
Thu Sep 10 14:37:06 CEST 2009


Hello,
please help me to understand how to do it correctly:

i have file globals.h with lines:
class MyClass;
namespace globals
{
	extern MyClass *myPtr;
}

in globals.cpp:
MyClass *globals::myPtr=NULL;

where can i create  by "new" this object and delete by "delete"?
so that it would be created before all widgets of my app created and 
destroyed on application close after all widgets destroyed?

main.cpp contains lines:

QApplication a( argc, argv );
return a.exec();

--
Serge



More information about the Qt-interest-old mailing list