Michael Sullivan wrote: > What is a non-virtual destructor? Does this mean that there are > virtual destructors too? How do I define one? Would it just be > > virtual ~Character(); > > Like that? I have two classes that subclass Character, and the method > in question will be handled slightly differently in each of them, so I > wanted to make the method virtual...
Read the chapter in Safe C++ Design Principles on Base Classes vs. Templates. It clearly describes when and how to use virtual destructors. Basic rule of thumb: If you derive from any class, all classes involved MUST have a virtual destructor to be cleaned up properly at runtime when the objects are no longer needed. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
