I know that we need placement new operator when memory for an object is to be allocated at a specfic memory location. e.g.
int* MemoryBuffer = malloc(sizeof(int)*10); MyClass* Object = new (MemoryBufer) Myclass;
Can't we simply do like this
MyClass* Object = reinterpret_cast<MyClass*>(MemoryBuffer);
Object will point to the memory allocated by malloc above. Why do we need placement new operator, does it do the same thing or there is any difference?