it;s better to use smart pointers: boost::shared_ptr is good for this case