#include #include "date.h" #include using namespace std; int main() { Date * pToday = new Date; // a new dynamic date is created using // the default constructor and its address // is stored in pointer today Date *dateptr; dateptr = new Date(1, 9, 2013); cout << "the value of the memory location pointed by today pointer is " << *pToday << endl; cout << "the value of the memory location pointed by dateptr pointer is " << *dateptr << endl; (*dateptr)++; // increment the value of memory location pointed by dateptr cout << *dateptr << endl; vector intptrs(10); // a vector with 10 integer pointers, // currently point nowhere for (int i=0; i < 10; i++) { intptrs[i] = new int; // pointers now point somewhere not initialized *(intptrs[i]) = 0; // now initialized to 0 } for (int i=0; i < 10; i++) cout << *(intptrs[i]) << " "; // check if correct cout << endl; return 0; }