title: Can't understand this error... "Type 'const intSet' does not provide a subscript operator" this is at the line with all of the asterisks
body: <hr>
  
  <h2>This is my .cpp file</h2>
  
  <pre><code>// FILE: IntSet.cpp - header file for IntSet class
  //       Implementation file for the IntStore class
  //       (See IntSet.h for documentation.)
  // INVARIANT for the IntSet class:
  // (1) Distinct int values of the IntSet are stored in a 1-D,
  //     compile-time array whose size is IntSet::MAX_SIZE;
  //     the member variable data references the array.
  // (2) The distinct int value with earliest membership is stored
  //     in data[0], the distinct int value with the 2nd-earliest
  //     membership is stored in data[1], and so on.
  //     Note: No "prior membership" information is tracked; i.e.,
  //           if an int value that was previously a member (but its
  //           earlier membership ended due to removal) becomes a
  //           member again, the timing of its membership (relative
  //           to other existing members) is the same as if that int
  //           value was never a member before.
  //     Note: Re-introduction of an int value that is already an
  //           existing member (such as through the add operation)
  //           has no effect on the "membership timing" of that int
  //           value.
  // (4) The # of distinct int values the IntSet currently contains
  //     is stored in the member variable used.
  // (5) Except when the IntSet is empty (used == 0), ALL elements
  //     of data from data[0] until data[used - 1] contain relevant
  //     distinct int values; i.e., all relevant distinct int values
  //     appear together (no "holes" among them) starting from the
  //     beginning of the data array.
  // (6) We DON'T care what is stored in any of the array elements
  //     from data[used] through data[IntSet::MAX_SIZE - 1].
  //     Note: This applies also when the IntSet is empry (used == 0)
  //           in which case we DON'T care what is stored in any of
  //           the data array elements.
  //     Note: A distinct int value in the IntSet can be any of the
  //           values an int can represent (from the most negative
  //           through 0 to the most positive), so there is no
  //           particular int value that can be used to indicate an
  //           irrelevant value. But there's no need for such an
  //           "indicator value" since all relevant distinct int
  //           values appear together starting from the beginning of
  //           the data array and used (if properly initialized and
  //           maintained) should tell which elements of the data
  //           array are actually relevant.
  
  #include "IntSet.h"
  #include &lt;iostream&gt;
  #include &lt;cassert&gt;
  using namespace std;
  
  
  IntSet::IntSet()
  {
      //initializing both of the private elements
      int data[MAX_SIZE];//max size to be changed
      int used(0);//I don't know what this stands for...
  }
  
  int IntSet::size() const//complete
  {
      int m=0;
      while(data[m]!='\0')
      {
          m++;
      }
      return m;
  }
  
  bool IntSet::isEmpty() const//complete
  {
      int m(0);
      while(data[m]!='\0')
      {
          m++;
      }
      if(m==0)
      {
          return 1;
      }
      else
      {
          return 0;
      }
  }
  
  bool IntSet::contains(int anInt) const//complete
  {
      int m(0);//iterator
      while(data[m]!=anInt)
      {
          m++;
      }
      if(m!=0)//if it does contain this number
      {
          return 1;
      }
      else //if it doesn't contain this number
      {
          return 0;
      }
  }
  
  bool IntSet::isSubsetOf(const IntSet&amp; otherIntSet) const
  {
      //variable initialization
      int k=0;
      int e=0;
      int m=0;
      int f=0;
      while(m != otherIntSet.size())
      {
          while(e!=1)
          {
              while(k != MAX_SIZE)
              {
                  cout&lt;&lt;k&lt;&lt;endl;//debug
                  if(IntSet[k] = otherIntSet[m])//********************
                  {
                      f++;//found one more
                      e = 1;//exit = 1
                  }
                  else
                  {
                      k++;
                  }
              }
          }
          if(f == otherIntSet.size())
          {
              return 1;
          }
          else
          {
              return 0;
          }
      }
     return false; // dummy value returned
  }
  
  void IntSet::DumpData(ostream&amp; out) const
  {  // already implemented ... DON'T change anything
     if (used &gt; 0)
     {
        out &lt;&lt; data[0];
        for (int i = 1; i &lt; used; ++i)
           out &lt;&lt; "  " &lt;&lt; data[i];
     }
  }
  
  IntSet IntSet::unionWith(const IntSet&amp; otherIntSet) const
  {
     cout &lt;&lt; "unionWith() is not implemented yet..." &lt;&lt; endl;
     return IntSet(); // dummy IntSet object returned
  }
  
  IntSet IntSet::intersect(const IntSet&amp; otherIntSet) const
  {
     cout &lt;&lt; "intersect() is not implemented yet..." &lt;&lt; endl;
     return IntSet(); // dummy IntSet object returned
  }
  
  IntSet IntSet::subtract(const IntSet&amp; otherIntSet) const
  {
     cout &lt;&lt; "subtract() is not implemented yet..." &lt;&lt; endl;
     return IntSet(); // dummy IntSet object returned
  }
  
  void IntSet::reset()
  {
     cout &lt;&lt; "reset() is not implemented yet..." &lt;&lt; endl;
  }
  
  bool IntSet::add(int anInt)
  {
     cout &lt;&lt; "add() is not implemented yet..." &lt;&lt; endl;
     return false; // dummy value returned
  }
  
  bool IntSet::remove(int anInt)
  {
     cout &lt;&lt; "remove() is not implemented yet..." &lt;&lt; endl;
     return false; // dummy value returned
  }
  
  bool equal(const IntSet&amp; is1, const IntSet&amp; is2)
  {
     cout &lt;&lt; "equal() is not implemented yet..." &lt;&lt; endl;
     return false; // dummy value returned
  }
  </code></pre>
  
  <hr>
  
  <h2>header file</h2>
  
  <pre><code>// FILE: IntSet.h - header file for IntSet class
  // CLASS PROVIDED: IntSet (a container class for a set of
  //                 int values)
  //
  // CONSTANT
  //   static const int MAX_SIZE = ____
  //     IntSet::MAX_SIZE is the highest # of elements an IntSet
  //     can accommodate.
  //
  // CONSTRUCTOR
  //   IntSet()
  //     Pre:  (none)
  //     Post: The invoking IntSet is initialized to an empty
  //           IntSet (i.e., one containing no relevant elements).
  //
  // CONSTANT MEMBER FUNCTIONS (ACCESSORS)
  //   int size() const
  //     Pre:  (none)
  //     Post: Number of elements in the invoking IntSet is returned.
  //   bool isEmpty() const
  //     Pre:  (none)
  //     Post: True is returned if the invoking IntSet has no relevant
  //           relevant elements, otherwise false is returned.
  //   bool contains(int anInt) const
  //     Pre:  (none)
  //     Post: true is returned if the invoking IntSet has anInt as an
  //           element, otherwise false is returned.
  //   bool isSubsetOf(const IntSet&amp; otherIntSet) const
  //     Pre:  (none)
  //     Post: True is returned if all elements of the invoking IntSet
  //           are also elements of otherIntSet, otherwise false is
  //           returned.
  //           By definition, true is returned if the invoking IntSet
  //           is empty (i.e., an empty IntSet is always isSubsetOf
  //           another IntSet, even if the other IntSet is also empty).
  //   void DumpData(std::ostream&amp; out) const
  //     Pre:  (none)
  //     Post: Contents of the invoking IntSet have been inserted into
  //           out with 2 spaces separating one item from another if
  //           if there are 2 or more items.
  //   IntSet unionWith(const IntSet&amp; otherIntSet) const
  //     Pre:  size() + (otherIntSet.subtract(*this)).size() &lt;= MAX_SIZE
  //     Post: An IntSet representing the union of the invoking IntSet
  //           and otherIntSet is returned.
  //     Note: Equivalently (see postcondition of add), the IntSet
  //           returned is one that initially is an exact copy of the
  //           invoking IntSet but subsequently has all elements of
  //           otherIntSet added.
  //   IntSet intersect(const IntSet&amp; otherIntSet) const
  //     Pre:  (none)
  //     Post: An IntSet representing the intersection of the invoking
  //           IntSet and otherIntSet is returned.
  //     Note: Equivalently (see postcondition of remove), the IntSet
  //           returned is one that initially is an exact copy of the
  //           invoking IntSet but subsequently has all of its elements
  //           that are not also elements of otherIntSet removed.
  //   IntSet subtract(const IntSet&amp; otherIntSet) const
  //     Pre:  (none)
  //     Post: An IntSet representing the difference between the invoking
  //           IntSet and otherIntSet is returned.
  //     Note: Equivalently (see postcondition of remove), the IntSet
  //           returned is one that initially is an exact copy of the
  //           invoking IntSet but subsequently has all elements of
  //           otherIntSet removed.
  //
  // MODIFICATION MEMBER FUNCTIONS (MUTATORS)
  //   void reset()
  //     Pre:  (none)
  //     Post: The invoking IntSet is reset to become an empty IntSet
  //           (i.e., one containing no relevant elements).
  //   bool add(int anInt)
  //     Pre:  contains(anInt) ? size() &lt;= MAX_SIZE : size() &lt; MAX_SIZE
  //     Post: If contains(anInt) returns false, anInt has been
  //           added to the invoking IntSet as a new element and
  //           true is returned, otherwise the invoking IntSet is
  //           unchanged and false is returned.
  //   bool remove(int anInt)
  //     Pre:  (none)
  //     Post: If contains(anInt) returns true, anInt has been
  //           removed from the invoking IntSet and true is
  //           returned, otherwise the invoking IntSet is unchanged
  //           and false is returned.
  //
  // NON-MEMBER FUNCTIONS
  //   bool equal(const IntSet&amp; is1, const IntSet&amp; is2)
  //     Pre:  (none)
  //     Post: True is returned if is1 and is2 have the same elements,
  //           otherwise false is returned; for e.g.: {1,2,3}, {1,3,2},
  //           {2,1,3}, {2,3,1}, {3,1,2}, and {3,2,1} are all equal.
  //     Note: By definition, two empty IntSet's are equal.
  
  #ifndef INT_SET_H
  #define INT_SET_H
  
  #include &lt;iostream&gt;
  
  class IntSet
  {
  public:
     static const int MAX_SIZE = 10;
     IntSet();
     int size() const;
     bool isEmpty() const;
     bool contains(int anInt) const;
     bool isSubsetOf(const IntSet&amp; otherIntSet) const;
     void DumpData(std::ostream&amp; out) const;
     IntSet unionWith(const IntSet&amp; otherIntSet) const;
     IntSet intersect(const IntSet&amp; otherIntSet) const;
     IntSet subtract(const IntSet&amp; otherIntSet) const;
     void reset();
     bool add(int anInt);
     bool remove(int anInt);
  
  private:
     int data[MAX_SIZE];
     int used;
  };
  
  bool equal(const IntSet&amp; is1, const IntSet&amp; is2);
  
  #endif
  </code></pre>
  
  <p>I have no idea what I need to do here... I also cannot figure out how to write the code for the Unionwith and intersect functions... any help from that point in my code until the end would be much appreciated. I am in Data Structures and it's getting real! Thank you!</p>