Placement New Syntax

How can a C++ developer use the placement new syntax to make new allocate an object of class SomeClass at a particular memory address stored in a pointer type variable named pmem?

A. new SomeClass(pmem);
B. new(pmem) SomeClass;
C. new SomeClass pmem;
D. new pmem SomeClass;
E. new (pmem, SomeClass);

Questions by dlee6565

Showing Answers 1 - 6 of 6 Answers


  • Oct 13th, 2009

It is B , provided pmem is an allocated pointer (meaning memory already allocated to it).

See this link for more explanation:


  • Sep 22nd, 2010


Where you use placement new, it is important to explicitly call the destructor for the object before re-using the memory.

Fred * fred = new(pmem) Fred();
fred = 0;

George * george(pmem) George();

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions