It looks like (albeit quite hidden due to the absence of any code indentation) they want the thread to be contained within the class itself. There are, of course, examples for that too in the tutorial.
Indeed, there's code that better matches what the OP is doing.
class ClassWithThread
{
public:
ClassWithThread()
: m_thread(&ClassWithThread::f, this)
{
}
private:
void f()
{
...
}
sf::Thread m_thread;
};
However, it is created only when the a() function is executed.
That's more a consequence of the OP not knowing how to do it
But with dynamic allocation it can also work like this anyway.
My angle here is that maybe it fails because b is out of scope so the way to address it would be via this.
The only reason it fails is because
the syntax is incorrect and the tutorial show the correct one.Just an idea
Please don't throw random ideas, just let the OP read the tutorial...