class myFunc
{
public:
void function() (/* No Parameters */)
{
cout << "myFunc object." << endl;
}
};
/*************************************/
myFunc myFunc1;
thread thread1(myFunc1);
if (thread1.joinable())
{
thread1.join();
}
class myFunc
{
public:
void pubFunc1()
{
cout << "publicFunc1 of myFunc class called" << endl;
}
};
/*****************************************************/
myFunc myFunc1;
thread thread1(&myFunc::pubFunc1,myFunc);
if (thread1.joinable())
{
thread1.join();
}
class myFunc
{
public:
void function()(int* arr, int length)
{
cout << "Array length: " << length << "...passed to thread1." << endl;
for (int i = 0; i != length; ++i)
{
cout << arr[i] << " " << endl;
}
}
};
/************************************************************************/
int arr[7] = { 0, 1, 2, 3, 4, 5, 6 };
myFunc myFunc1;
thread thread1(myFunc1, arr, 7);
if (thread1.joinable())
{
thread1.join();
}