   Inheritance and dynamic creation
  Hey guys,If I create a derived object using the new command and add it to a std::vector of pointers for the base class such as:class foo;class derivedfoo;std::vector<foo*> list;derivedfoo = new derivedfoo();list.add(&derivedfoo);if I want to delete it using the list such as:for(int i = 0; i < list.size(); i++){  delete list;}Will it only call the basse class destructor so the derivedfoos objects are not destructed.   
  Which destructor is called depends on whether or not the destructor was defined as virtual in the base class. If it is, then everything should be fine. If not, then bad things happen.   ;  If you have a virtual destructor in foo, every object will be correctly destroyed. If you don't, then only the base destructor would be called. So when you plan to inherit, you should declare your destructor virtual.   