Im trying to create a map container with the key being an ID number and the value being a pointer to a class object. Currently Im creating objects and storing their address in the container. I am getting a runtime error when calling the virtual method with this pointer. I believe that the problem is being called because they aren't being called pointer/reference. let me know if you need more.
The variable created on line 4 is destroyed on line 9 because it is bound to the scope it was created in. Unfortunately you store its address on line 5 and line 8, which means when it gets destroyed on line 9 you have store a dangling pointer.
Then you try to call functions on memory that you no longer own and has probably been changed since then.