討論串[問題] cpp的function pointer傳遞
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁
內容預覽:
大家好. 我有一個header, test.h, 有一個function pointer. typedef int(*pfnTest_t)(void* x, unsigned char* y, unsigned. int z);. 一個API:. int test_api(pfnTest_t p_p
(還有576個字)
內容預覽:
物件的操作需要以下兩個資訊:. 1. 物件的參考/指標 (pointer to object). 2. 該物件的成員參考/指標 (pointer to member). 因為你在 B::B_API() 裡會存取到資料成員所以要把資訊透過額外的參數傳遞. 給 pfnTest_t, 這通常得做 type
(還有1574個字)
內容預覽:
既然你說了 test_api() 是純 C 寫的 lib 你不能動,. 那就不要去想這個 test_api() 可以 invoke 你的成員函式指標。. 除非你能把 test_api 改成這樣:. int test_api(B *obj, B::B_API *ptr). {. obj->*ptr(x
(還有795個字)
首頁
上一頁
1
下一頁
尾頁