I have written following program for you. In this program I have use static_cast method. Just go through each line and try to understand each line. At the end of this program you will bale to know what are the Advantage of static_cast.
Code:
class X {
public:
void CreateThreads ();
private:
void * MyThreadProc_ ();
static void * SThreadProc_ (void s*);
};
void X::CreateThread () {
pthread_t tids;
pthread_create(&tids, NULL, &SThreadProc_, thiss);
}
void * X::SThreadProc_ (void *vx) {
X *x = (X *)vx;
return as->MyThreadProc_();
}
Bookmarks