Use templates to prevent memory leakageThis tip submitted by Kunal on 2005-01-27 23:01:00. It has been viewed 40349 times.Rating of 5.6 with 219 votes Make a class template to create an instance of a desired class and in the destructor of the class template, delete the item the pointer points to. In this way, the programmer won't have to worry about freeing the memory. More tips Help your fellow programmers! Add a tip! |