Module 5. Linked Lists, Stacks, Queues Exercise Answers

1.
   ZooAnimal::ZooAnimal (char* theName)
   {
      char *name = new char[20];
      strcpy(name, theName);

      // Insert the new animal in the linked list
      prevAnml = current;
      nextAnml = NULL;
      if (current!=NULL)
         current->nextAnml = this;
      current = this;
   }


2.
   ZooAnimal::~ZooAnimal()
   {
      // Reset the linked list global data
      current = this->prevAnml;
      if (current == NULL)
        start = NULL;
   }


3.
    cout << "This animal's name is " << creature[whichOne].reptName () << endl;