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);
Hmm. This confuses me a bit as I'm only use to seeing:
But I'm rather sure A is correct as its a copy constructor. And the rest are incorrect.Code:
someClass *pmem = new someClass;
Can anyone confirm. Thx.