I am writing a template class that takes a pointer as a pointer and saves it. A pointer is intended to point to an object allocated by another class, and passed to this containing class.
Now I want to create a destructor for this container. How do I free the memory pointed to by this pointer? I do not know a priori, whether it be an array or a single element.
I'm kind of new to C ++, so bear with me. I always used C, and Java is my OO choice language, but between the desire to learn C ++ and the speed requirements of my project, I went with C ++.
Would it be better to change the container from a template to a container for an abstract class that can implement its own destructor?
c ++ destructor templates
Alex
source share