I was asked an interview question: How can we allocate two objects of a class in different functions using the new operator such that they use the same memory space?
Can anyone explain how this can be achieved? Thanks.
EDIT: So the main question was how to create a class Memory_Alloc which should be used by all other classes to allocate memory for their objects. I thought about using Handles. Then he asked me the above question.
The question is a little vague, but off the top of my head you could use: