"Ramesh Tharma" <ra********@yahoo.com> wrote in message
news:65*******************@news20.bellglobal.com.. .
How do you create an object into a specific address ?
With the built-in placement-new:
#include <new>
then:
MyClass *p = new ( (void*)theAddress ) MyClass(constructorParams...);
You will then also be in charge of destroying the object,
as follows:
p->~MyClass();
Keep in mind this is an advanced technique (difficult to get right).
Beware of memory-alignment requirements that the class may have,
and of proper exception-handling...
You will find uses of these technique in the implementation
of standard library containers, which you should have access to.
hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <>
http://www.brainbench.com