text: //  Created by Frank M. Carrano and Tim Henry.
  //  Copyright (c) 2013 __Pearson Education__. All rights reserved.
  
  /// ADT bag: Link-based implementation. @file LinkedBag.h Listing 4-3
  #ifndef _LINKED_BAG
  #define _LINKED_BAG
  
  #include "BagInterface.h"
  #include "Node.h"
  
  template<class ItemType>
  class LinkedBag : public BagInterface<ItemType>
  {
  private:
  	// Pointer to first node
     Node<ItemType>* headPtr;
  	// Current count of bag items
     int itemCount;
     
     // Returns either a pointer to the node containing a given entry
     // or the null pointer if the entry is not in the bag.
     Node<ItemType>* getPointerTo(const ItemType& target) const;
     
  public:
     LinkedBag();
  	// Copy constructor
     LinkedBag(const LinkedBag<ItemType>& aBag);
  	// Destructor should be virtual
     virtual ~LinkedBag(); 
     int getCurrentSize() const;
     bool isEmpty() const;
     bool addWithResize(const ItemType& newEntry);
     bool remove(const ItemType& anEntry);
     void clear();
     bool contains(const ItemType& anEntry) const;
     int getFrequencyOf(const ItemType& anEntry) const;
     vector<ItemType> toVector() const;
  }; // end LinkedBag
  
  #endif
  