Each time the loop runs, a new object of myclass is created and the pointer is reassigned to the new class. *But the old class is still in memory somewhere, right? *Should the [tt]delete (myclass);[/tt] statement go inside the loop?Code:MyClass *myclass; ... while (blah blah){ * * *... * * *myclass = new MyClass (blah blah); * * *... } delete (myclass);


Reply With Quote
Bookmarks