Archived

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

Shian

callback function

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