title: Pointer to function-member
body: <p>I have a FreeRTOS function <code>xTaskCreate</code>. Simplified declaration looks like</p>
  
  <pre><code>typedef void (*TaskFunction_t)( void* );
  unsigned xTaskCreate( TaskFunction_t pxTaskCode, void*params );
  </code></pre>
  
  <p>And there are two classes:</p>
  
  <pre><code>class Super {
      virtual void task(void*params) = 0;
  };
  class Derived1 : public Super {
      virtual void task(void*params){ while(1){ blinkLed(1); delay_ms(333); } }
  };
  class Derived2 : public Super { ... ;}
  </code></pre>
  
  <p>In function <code>init()</code> I select one of derived classes and create its instance. Then want to create task </p>
  
  <pre><code>void init(){
      Super *obj = condition ? new Derived1 : new Derived2;
      xTaskCreate( obj-&gt;task ); // WRONG.
  }
  </code></pre>
  
  <p>Upd. Add missed <code>void*params</code> in Simplified declaration of <code>xTaskCreate</code>.</p>