title: How can I pass method pointer as a function parameter in C++ while using pthreads
body: <p>I have a question related with C++ and threads.
  I am more familiar with Java than C++ and this error is confusing me.</p>
  
  <p>Imagine that in x.h file I have a class such as:</p>
  
  <pre><code>class A{
  
      public A();
  
      public virtual void* func(void*);
  
      public virtual void func2();
  
      public virtual void func3();
  
  };
  </code></pre>
  
  <p>In x.cpp file I want to do that:</p>
  
  <pre><code>void* A::func(void*) {
  
      while(....)
          func2();
  
      return NULL;
  }
  
  void A::func2() {
  
      ...some stuff there...
  
  }
  
  void A::func3() {
  
      pthread_t t1;
  
      pthread_create(&amp;t1, NULL, &amp;A::func, NULL);
  
      void* result;
  
      pthread_join(t1,&amp;result);
  
      ...some other stuff...
  
  }
  </code></pre>
  
  <p>The problem is it hangs with the following error:</p>
  
  <blockquote>
    <p>"error: ISO C++ forbids taking the address of an unqualified or
    parenthesized non-static member function to form a pointer to member
    function."</p>
  </blockquote>
  
  <p>What should I do to fix this?</p>
  
  <p>Thanks.</p>