Make sure your base class has a virtual destructor or else calling delete on the base class pointer will not call the right destructor.