title: No Match for Operator[]
body: <p>So I'm trying to use a sorting function (similar to bubble) and pass into it an object. If that object is bigger (alphabetically) then switch then return true and switch that with the before it. I keep getting an error though inside the if statement inside <code>mySort()</code> which says "no match for operator[] in arr[j]" but from my understanding I'm passing an object array right? Why is this happening and how can I solve it?</p>
  
  <p>Here's the driver</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include "phoneEntry.h"
  using namespace std;
  
  void mySort(PhoneEntry &amp;arr, int size)
  {
      bool inOrder = false;
      string temp;
      for (int i = size - 1; i &gt; 0 &amp;&amp; !inOrder; i--)
      {
          inOrder = true;
          for (int j = 0; j &lt; i; j++)
          {
              if(arr.alphaGreater(arr[j]))
              {
                  inOrder = false;
                  temp = arr[j];
                  arr[j] = arr[j + 1];
                  arr[j + 1] = temp;
              }
          }
      }
  };
  
  int main()
  {   
      const int MAXNUM = 500;
      PhoneEntry entry[MAXNUM];
      ifstream filezilla;
      filezilla.open("phone.txt");
      int count = 0;
  
      if(filezilla)
      {
          while(count &lt; MAXNUM &amp;&amp; entry[count].readEntry(filezilla))
          {
              count++;
              mySort(entry[count], count);
          }   
  
          for(int i = 0; i &lt; count; i++)
          {
              entry[i].writeEntry(cout) &lt;&lt; endl;
          }
      }
      else
      {
          cout &lt;&lt; "404" &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p><a href="http://pastebin.com/f6Xvu398" rel="nofollow">Phone Entry Header</a></p>
  
  <p><a href="http://pastebin.com/ytdi8x3D" rel="nofollow">Phone Number Header</a></p>
  
  <p>Sorting Text (http://pastebin.com/HE8Rsmbg)</p>