Object method as callback
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:
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.