title: Function for the thread within a class in C++
body: <p>I'm having troubles with creation of the function, that should handle new thread. When I create it outside of the class, everything works allright, but when I want to create it inside a class, I can't realize, how to call it.</p>
  
  <p>I call the function with:</p>
  
  <pre><code>pthread_t thread;
  pthread_create(&amp;thread, NULL,
          sendMessage, (void *) fd);
  </code></pre>
  
  <p>and the function itself looks like this:</p>
  
  <pre><code>void * sendMessage(void *threadid) {
      string message;
      const char * c;
      char buffer[200];
      int fd = (long) threadid;
      while (true) {
          cin &gt;&gt; message;
  
          if (message == "exit") {
              break;
          }
  
          c = message.c_str();
          strncpy(buffer, c, sizeof ( buffer));
          send(fd, buffer, strlen(buffer), 0);
      }
  }
  </code></pre>
  
  <p>but when I declare it within a class e.g. <code>void * Client::sendMessage(void *threadid)</code> , I can't even build it because I get <code>main.cpp:90:37: error: argument of type ‘void* (Client::)(void*)’ does not match ‘void* (*)(void*)’</code> Does anybody have any idea, what can cause it and how to fix it? </p>