user16105: I am trying to pass a class internal function as a callback function within the class. The error behavior is similar to this problem. Whatsoever, I was unable to construct working code based on that question's answer. 
I try to pass over a callback function from within the class,in order to create a finite state machine, inspired by the examples I found on adafruit regarding multithreading. The idea is, that each state can call his successor. The class itself then represents the state machine and I just will call its update function.
While the following code does not resemble this utility, it resembles the problem in a minimal example (based on this larger codepiece):
class MyClass
{
  const byte theAnswer = 42;
  void (*myCallback)();

  void setCallback(void (*callback)())
  {
    myCallback = callback;
  }

  public:

  void print_info()
  {
    Serial.println(theAnswer);
  }

  void call()
  {
    myCallback();
  }

   MyClass()
  {
    setCallback(&MyClass::print_info);
  }
};


MyClass AClassOfItsOwn();

void setup() 
{
  Serial.begin(9600);
  while (! Serial); // Wait until Serial is ready
}

void loop() 
{
  AClassOfItsOwn.call();
  return;
}

I get the following error code returned:

...testscript.ino: In constructor 'MyClass::MyClass()':
testscript:25: error: no matching function for call to
  'MyClass::setCallback(void (MyClass::*)())'
     setCallback(&MyClass::print_info);

                                     ^

...\testscript.ino:25:41:
  note: candidate is:
...\testscript.ino:6:12:
  note: void MyClass::setCallback(void (*)())
   void setCallback(void (*callback)())

        ^

...\testscript.ino:6:12:
  note:   no known conversion for argument 1 from 'void (MyClass::)()'
  to 'void ()()'
...\testscript.ino:
  In function 'void loop()':
testscript:40: error: request for member 'call' in 'AClassOfItsOwn',
  which is of non-class type 'MyClass()'
   AClassOfItsOwn.call();

                  ^

exit status 1 no matching function for call to
  'MyClass::setCallback(void (MyClass::*)())'


fun times with polymorphism
This is code we discussed during looking for a solution. I leave it here for future reference.
I tried creating an instance of this wrapper within the actual class to hold the callback, but that did not work either. 
class CallbackWrapper
{
  void (*myCallback)();
  public:

  void call()
  {
    myCallback();
  }

  void setCallback(void (*callback)())
  {
    myCallback = callback;
  }
};

class MyClass : public CallbackWrapper
{
  const byte theAnswer = 42;
  public:

  void print_info()
  {
    Serial.println(theAnswer);
  }

   MyClass()
  {
    CallbackWrapper::setCallback(&MyClass::print_info);
  }
};

trying to store the callback function in a wrapping class (also not working, '((MyClass*)this)->MyClass::CBW' does not have class type)
class CallbackWrapper
{
  void (*myCallback)();
  public:

  void call()
  { myCallback(); }

  void setCallback(void (*callback)())
  { myCallback = callback; }
};

class MyClass 
{
  const byte theAnswer = 42;
  CallbackWrapper CBW();
  public:
  void print_info() { Serial.println(theAnswer); }
  void call() { CBW.call(); }
  MyClass()
  { CBW.setCallback(&MyClass::print_info); }
};

An update on why I want to change the callback function during runtime. Here I try to randomly change the callback function:
class MyClass 
{
  CallbackWrapper CBW();
  public:
  void do_this() { Serial.println("doing this"); }
  void do_that() { Serial.println("doing that"); }
  void call() 
  { 
    CBW.call();
    if (rand() > 0.5)
    {
      CBW.setCallback(&MyClass::do_this)
    }
    else
    {
      CBW.setCallback(&MyClass::do_that)
    }
  }
   MyClass()
  {  }
};

For discussion with Michail
class CallbackWrapper
{
  public:
  void (*myCallback)();
  void call()
  { myCallback(); }

  virtual void setCallback(void (*callback)())
  {  }
};

class MyClass : public CallbackWrapper
{
  public:
  void setCallback(void (*callback)())
    { myCallback = callback; }
  void do_this() { Serial.println("doing this"); }
  void do_that() { Serial.println("doing that"); }
  void call() 
  { 
    CallbackWrapper::call();
    if (rand() > 0.5)
    { setCallback(&MyClass::do_this); }
    else
    { setCallback(&MyClass::do_that); }
  }
   MyClass()
  {  }
};


user4143: Unless you specifically limit yourself to one single class for a callback (i.e., include the class name in the function pointer specification) then you can ONLY use static member functions as callbacks.
static member functions appear as a normal function, not a member function, so don't have the implied MyClass *this as a first parameter.
If you want to allow member functions that aren't static you will have to make use of polymorphism and have a single base class that all classes which provide a callback function will inherit from.  Then you limit the callback function pointer to be members of that base class.
It is possible to do it if you are happy to limit to just one class, though the syntax is rather cryptic:
class MyClass 
{
  const byte theAnswer = 42;
  void (MyClass::*myCallback)();

public:

  void call() {
    (this->*myCallback)();
  }

  void setCallback(void (MyClass::*callback)()) {
    myCallback = callback;
  }

  void print_info() {
    Serial.println(theAnswer);
  }

  MyClass() {
    setCallback(&MyClass::print_info);
  }
};

Using polymorphism you can only pass a callback function that is a member of the parent class, so it looks like that method may be out.

16105: <p>I am trying to pass a class internal function as a callback function within the class. The error behavior is similar to <a href="https://arduino.stackexchange.com/questions/14480/pass-a-member-function-pointer-to-a-method-of-a-foreign-class-edb-lib">this problem</a>. Whatsoever, I was unable to construct working code based on that question's answer. </p>

<p>I try to pass over a callback function from within the class,in order to create a finite state machine, inspired by the examples I found on adafruit regarding multithreading. The idea is, that each state can call his successor. The class itself then represents the state machine and I just will call its update function.</p>

<p>While the following code does not resemble this utility, it resembles the problem in a minimal example (based on <a href="https://learn.adafruit.com/multi-tasking-the-arduino-part-3/put-it-all-together-dot-dot-dot" rel="nofollow noreferrer">this larger codepiece</a>):</p>

<pre><code>class MyClass
{
  const byte theAnswer = 42;
  void (*myCallback)();

  void setCallback(void (*callback)())
  {
    myCallback = callback;
  }

  public:

  void print_info()
  {
    Serial.println(theAnswer);
  }

  void call()
  {
    myCallback();
  }

   MyClass()
  {
    setCallback(&amp;MyClass::print_info);
  }
};


MyClass AClassOfItsOwn();

void setup() 
{
  Serial.begin(9600);
  while (! Serial); // Wait until Serial is ready
}

void loop() 
{
  AClassOfItsOwn.call();
  return;
}
</code></pre>

<p>I get the following error code returned:</p>

<blockquote>
  <p>...testscript.ino: In constructor 'MyClass::MyClass()':</p>
  
  <p>testscript:25: error: no matching function for call to
  'MyClass::setCallback(void (MyClass::*)())'</p>

<pre><code>     setCallback(&amp;MyClass::print_info);

                                     ^
</code></pre>
  
  <p>...\testscript.ino:25:41:
  note: candidate is:</p>
  
  <p>...\testscript.ino:6:12:
  note: void MyClass::setCallback(void (*)())</p>

<pre><code>   void setCallback(void (*callback)())

        ^
</code></pre>
  
  <p>...\testscript.ino:6:12:
  note:   no known conversion for argument 1 from 'void (MyClass::<em>)()'
  to 'void (</em>)()'</p>
  
  <p>...\testscript.ino:
  In function 'void loop()':</p>
  
  <p>testscript:40: error: request for member 'call' in 'AClassOfItsOwn',
  which is of non-class type 'MyClass()'</p>

<pre><code>   AClassOfItsOwn.call();

                  ^
</code></pre>
  
  <p>exit status 1 no matching function for call to
  'MyClass::setCallback(void (MyClass::*)())'</p>
</blockquote>

<hr>

<p><strong>fun times with polymorphism</strong></p>

<p>This is code we discussed during looking for a solution. I leave it here for future reference.</p>

<p>I tried creating an instance of this wrapper within the actual class to hold the callback, but that did not work either. </p>

<pre><code>class CallbackWrapper
{
  void (*myCallback)();
  public:

  void call()
  {
    myCallback();
  }

  void setCallback(void (*callback)())
  {
    myCallback = callback;
  }
};

class MyClass : public CallbackWrapper
{
  const byte theAnswer = 42;
  public:

  void print_info()
  {
    Serial.println(theAnswer);
  }

   MyClass()
  {
    CallbackWrapper::setCallback(&amp;MyClass::print_info);
  }
};
</code></pre>

<p>trying to store the callback function in a wrapping class (also not working, <code>'((MyClass*)this)-&gt;MyClass::CBW' does not have class type</code>)</p>

<pre><code>class CallbackWrapper
{
  void (*myCallback)();
  public:

  void call()
  { myCallback(); }

  void setCallback(void (*callback)())
  { myCallback = callback; }
};

class MyClass 
{
  const byte theAnswer = 42;
  CallbackWrapper CBW();
  public:
  void print_info() { Serial.println(theAnswer); }
  void call() { CBW.call(); }
  MyClass()
  { CBW.setCallback(&amp;MyClass::print_info); }
};
</code></pre>

<p>An update on why I want to change the callback function during runtime. Here I try to randomly change the callback function:</p>

<pre><code>class MyClass 
{
  CallbackWrapper CBW();
  public:
  void do_this() { Serial.println("doing this"); }
  void do_that() { Serial.println("doing that"); }
  void call() 
  { 
    CBW.call();
    if (rand() &gt; 0.5)
    {
      CBW.setCallback(&amp;MyClass::do_this)
    }
    else
    {
      CBW.setCallback(&amp;MyClass::do_that)
    }
  }
   MyClass()
  {  }
};
</code></pre>

<p>For discussion with Michail</p>

<pre><code>class CallbackWrapper
{
  public:
  void (*myCallback)();
  void call()
  { myCallback(); }

  virtual void setCallback(void (*callback)())
  {  }
};

class MyClass : public CallbackWrapper
{
  public:
  void setCallback(void (*callback)())
    { myCallback = callback; }
  void do_this() { Serial.println("doing this"); }
  void do_that() { Serial.println("doing that"); }
  void call() 
  { 
    CallbackWrapper::call();
    if (rand() &gt; 0.5)
    { setCallback(&amp;MyClass::do_this); }
    else
    { setCallback(&amp;MyClass::do_that); }
  }
   MyClass()
  {  }
};
</code></pre>
 4143: <p>Unless you specifically limit yourself to one single class for a callback (i.e., include the class name in the function pointer specification) then you can ONLY use <code>static</code> member functions as callbacks.</p>

<p><code>static</code> member functions appear as a normal function, not a member function, so don't have the implied <code>MyClass *this</code> as a first parameter.</p>

<p>If you want to allow member functions that aren't <code>static</code> you will have to make use of <em>polymorphism</em> and have a single <em>base</em> class that all classes which provide a callback function will inherit from.  Then you limit the callback function pointer to be members of that base class.</p>

<p>It is possible to do it if you are happy to limit to just one class, though the syntax is rather cryptic:</p>

<pre><code>class MyClass 
{
  const byte theAnswer = 42;
  void (MyClass::*myCallback)();

public:

  void call() {
    (this-&gt;*myCallback)();
  }

  void setCallback(void (MyClass::*callback)()) {
    myCallback = callback;
  }

  void print_info() {
    Serial.println(theAnswer);
  }

  MyClass() {
    setCallback(&amp;MyClass::print_info);
  }
};
</code></pre>

<p>Using polymorphism you can only pass a callback function that is a member of the parent class, so it looks like that method may be out.</p>
