title: Passing compare function into qsort c++
body: <p>My compare function is dependent on data members in Foo and I therefore wish to contain it in this class. All examples use global functions which works but its not what I'm looking for. I'd like each instance of Foo to have a different compare based on the current status of the object.</p>
  
  <pre><code>class Foo
  {
  public:
     Foo(){}
  
     int Compare(const void * a,const void * b)
     {
      //Comparing logic
      //This is fine
     }
  
     void SortStuff(void)
     {
      qsort(ObjectArray,MAXOBJECTS,sizeof(Object*), Compare);
     }    
  
  };
  </code></pre>