#include #include #include #include "obj.h" using namespace std; int main() { obj ob = 10; vector v; v.push_back(&ob); for (vector::const_iterator it = v.begin(); it != v.end(); ++it){ cout << "The obj at address " << *it << " is " << **it << ".\n"; //Can also say (**it).print() or (*it)->print() } //Destruct v and ob, in that order. //Do not allow v to even momentarily hold a pointer to a destructed obj. return EXIT_SUCCESS; }