new operator in function parameter
I have a function and that function takes in a class pointer. the problem is that I call the class pointer like this. Function (new ChildClass); the function looks something like this void Function (BaseClass *instance) { childClassInstance = instance; } the reason why I call it with the new keyword is because I need it outside my function. What I wanted to know was. When I'm ready to delete instance. How would I go about it? Since it's in the function parameter, how would I go about calling it in order to delete it? or how would I be able to access it's location in memory to be able to delete