I am writing a really simple c++ program.
#include<iostream>
#include<thread>
class Fortest{
private:
int x;
public:
Fortest(int a)
{
x=a;
}
void run(void)
{
cout<<"test sucesses!"<<endl;
}
};
int main()
{
Fortest hai(1);
std::thread t;
t=std::thread(std::ref(hai),&Fortest::run());
t.join();
cout<<"program ends"<<endl;
return 0;
}
And I am constantly getting the error "cannot call a member function without an object". Could anyone help me to solve this problem?