I have a function, and this function takes a pointer to a class. the problem is that I am calling the class pointer as follows.
Function (new ChildClass);
the function looks something like this:
void Function (BaseClass *instance)
{
childClassInstance = instance;
}
The reason I call it the new keyword is because I need it outside of my function. What I wanted to know was. When I am ready to delete an instance. How can i do this? Since this is in a function parameter, how would I like to call it to remove it? or how can I access its location in memory to delete it?
If this is not possible, then what would be the best solution?
source
share