How do we ususaly deal with a vector whose elements are pointers to object? My specific question is the comment at the end of the code supplied below. Thanks.
Yes, you have to do that to avoid memory leak. The better ways to do that are to make a vector of shared pointers (boost, C++TR1, C++0x, )
std::vector > l;
or vector of unique pointers (C++0x) if the objects are not actually shared between this container and something else
std::vector> l;
or use boost pointer containers
boost::ptr_vector l;
PS: Don't forget A's virtual destructor, as per @Neil Butterworth!