Advanced C++
Q73 / 100

What is placement new in C++?

Correct! Well done.

Incorrect.

The correct answer is B) Constructing an object at a pre-allocated memory location without additional allocation

B

Correct Answer

Constructing an object at a pre-allocated memory location without additional allocation

Explanation

new (buffer) MyClass(args) constructs a MyClass in the already-allocated buffer. Used in memory pools and custom allocators. Requires explicit destructor call.

Progress
73/100