//nodetest.cpp #include #include"node.h" using namespace std; //#define NODETEST_CPP #ifdef NODETEST_CPP int main() { //Nodes on the stack Node n(5); cout << "the node on the stack has data: " << n << endl; //Nodes on the free store Node * pFreeze = 0; pFreeze = new Node(32); cout << "*pFreeze's data: " << *pFreeze<< endl; Node * pBoil = new Node(212); //(*pFreeze).setNext(pBoil); //ok but awkward. pFreeze->setNext(pBoil); cout << "*pFreeze data: " << *pFreeze << endl; cout << "*pBoil data: " << *pBoil << endl; cout << "*pFreeze->getNext() data: " << *(pFreeze->getNext()) << endl; //clean up our mess delete pFreeze->getNext(); delete pFreeze; //could we reverse these two lines? //delete pBoil; //uncomment and try //test input cout << "enter an integer: "; cin >> n; cout << "n's new value is: " << n << endl; return 0; } #endif