المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Creating Global Objects



C++ Programming
04-17-2009, 09:30 PM
Hi

I have an Object/Class derived from Cevent I would some how like to instantiate it

well actually make a global copy of it via the new operator on the Heap available For

the entire app

I know using the static keyword I can acoomplish this

e.g .static Myevent Myevent1; however using the new operator presents a problem


So....

I ended up allocating the storage required on the Heap

myeventptr = HeapAlloc(GetProcessHeap(),0,sizeof(MyEvent))

and the then kicking of the constructer via myeventptr->MyEvent::MyEvent(....);

is this going to create the object for me ???


thankx