Archived

This topic is now archived and is closed to further replies.

callback function

This topic is 6281 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a callback function in my class, like this: class A { public: void setCallback(void (__cdecl *Callback)(int num)); private: void (__cdecl *CallbacFunction)(int num);//store the point } And I want to set a function in class to be the callback function. class B { public: B(){ a.setCallback(cbTest); } void __cdecl cbTest(int num); A a; } But it did not work! I have a error message : " cannot convert parameter 1 from ''void (int)'' to ''void (__cdecl *)(int) " How can I do?

Share this post


Link to post
Share on other sites
Someone can tell me where it is?
I always get error message,when i use "Search".

Microsoft OLE DB Provider for SQL Server error ''80040e31''
Timeout expired
/community/forums/Search.asp, line 61


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You can''t do this with regular c-style function pointers. Look up the C++ FAQ Lite by Marshall Cline and you''ll find help on "member function pointers" and even a nice, helpful little macro.

Share this post


Link to post
Share on other sites