How to delete a pointer pointing to a dynamically allocated object inside a dynamically allocated object?

From my understanding, you have a situation where your Parser class has a Person object, but you want the Person object to be able to outlive the Parser object. This is what std::shared_ptr is for.

I think you need a combination of shared_ptr and unique_ptr. Strategy type should be in one of your base classes, and you should use shared/unique ptr based on need, it's unique_ptr here for now. That way you are certain re-assignment will not leak or better check if it is already assigned.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions