C++ ???????????????
???????????? ???????[ 2017/3/3 10:22:38 ] ????????C++ ???????????
????????????????
?????????????????????????????????
????<code class="sourceCode cpp">class Std_interface {
????public:
????virtual void suspend() = 0;
????};
????// define the pointer of function
????typedef void (Std_interface::* Pstd_mem) ()
????void f(Std_interface* p) {
????Pstd_mem s = &Std_interface::suspend;
????// call directly
????p->suspend();
????// by pointer
????(p->*s)();
????}</code>
????????????????????????????????????????????????????::???????????????????ú???????????????????????
???????ú???????????????????????????????????????????????????????????????????????????????????????
???????????
????????????????????????????????????????????????????????????????????????static ????????????????
?????????????this????????ú??? ????????????г??
??????????????ú?????????????????????У????????′???
????<code class="sourceCode cpp">// GlAnimator.h
????class GlAnimator {
????public:
????int example();
????friend int LoopInThread(GlAnimator *animator_ptr);
????};
????// GlAnimator.cpp
????typedef int(*InnerLoop)(GlAnimator *);
????int GlAnimator::example() {
????InnerLoop inner_loop = &LoopInThread;
????return 0;
????}
????// friend function
????int LoopInThread(GlAnimator *animator_ptr) {
????// ...
????return 0;
????}</code>
????InnerLoop inner_loop = &LoopInThread; ??????????"LoopInThread undeclared" ??????????????????????????????!???????????????????????????????????????????example()????????????????????????????????
???????????????????????飬??????????飬???????????????????????????????????????????????£?
????<code class="sourceCode cpp">// GlAnimator.h
????class GlAnimator {
????public:
????int example();
????friend int LoopInThread(GlAnimator *animator_ptr);
????};
????// declare the friend function again
????int LoopInThread(GlAnimator *animator_ptr);</code>
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11