C++ Pointer: changing the contents without changing the address?

前端 未结 6 1819
悲&欢浪女
悲&欢浪女 2020-12-31 05:11
MyCustomObject * object=new MyCustomObject();

Assume the object pointer is used by many of my classes, but all of a sudden I want to change the con

6条回答
  •  灰色年华
    2020-12-31 05:43

    Implement allocator to return same address, and use it in new and delete operator overloaded.

提交回复
热议问题