fork download
  1. #include <iostream>
  2. #include <thread>
  3.  
  4. volatile int run = true;
  5.  
  6. using namespace std;
  7. class thA
  8. {
  9. public:
  10. int fun(int a, int b, int c)
  11. {
  12. cout << "Farewell World" << endl;
  13. run = false;
  14. return a + b + c;
  15. }
  16. int fun()
  17. {
  18. cout << "Hello World" << endl;
  19. run = false;
  20. return 0;
  21. }
  22. };
  23. int main()
  24. {
  25. thA a;
  26.  
  27. using func = int (thA::*)(int,int,int);
  28.  
  29. thread classAAA( func(&thA::fun), a, 0, 1, 2);
  30.  
  31. classAAA.detach();
  32. while(run){}
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0.02s 5304KB
stdin
Standard input is empty
stdout
Farewell World