討論串[問題] cpp的function pointer傳遞
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓3(3推 0噓 25→)留言28則,0人參與, 3年前最新作者sighAll (sigh)時間3年前 (2020/09/29 19:17), 3年前編輯資訊
1
0
0
內容預覽:
大家好. 我有一個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個字)

推噓0(0推 0噓 2→)留言2則,0人參與, 3年前最新作者loveme00835 (髮箍)時間3年前 (2020/10/01 09:24), 3年前編輯資訊
0
0
1
內容預覽:
物件的操作需要以下兩個資訊:. 1. 物件的參考/指標 (pointer to object). 2. 該物件的成員參考/指標 (pointer to member). 因為你在 B::B_API() 裡會存取到資料成員所以要把資訊透過額外的參數傳遞. 給 pfnTest_t, 這通常得做 type
(還有1574個字)

推噓3(3推 0噓 0→)留言3則,0人參與, 3年前最新作者tinlans ( )時間3年前 (2020/10/01 21:24), 編輯資訊
0
0
0
內容預覽:
既然你說了 test_api() 是純 C 寫的 lib 你不能動,. 那就不要去想這個 test_api() 可以 invoke 你的成員函式指標。. 除非你能把 test_api 改成這樣:. int test_api(B *obj, B::B_API *ptr). {. obj->*ptr(x
(還有795個字)
首頁
上一頁
1
下一頁
尾頁