#include <iostream> #include <string> #include <system_error> #include <thread> class BackgroundTask { public: void operator()() const { std::cout << "Hello Multithreading World" << std::endl; } }; int main() { try { BackgroundTask task; std::thread myThread(task); myThread.join(); } catch (std::system_error const &error) { std::cout << error.what() << std::endl; return -1; } return 0; }