You can't because it's not supported yet, but maybe you can come close with
interface IntCallback { int func(); }; class Obj : public IntCallback { public: Obj() { } public: int func() { return 1; } public: void print_icb(IntCallback *icb) { Print(icb.func()); } public: void print() { print_icb(&this); } };
(dirty hack):
put the callback inside a struct or class
Please refer to:
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I'm trying to use an object method as a callback, inside an object method.
The only solution i found was to take out 'func' of the class scope, but i want to keep the benefit of ... well ... the class scope.
Is it possible to achieve what i'm trying to do ? Is my syntax wrong somewhere ? How would you procede otherwise ?
Thanks for your advices.