Page 1 of 1

Method pointers

Posted: Sat Jun 05, 2021 5:46 am
by wazzcob
I don’t understand one thing. Suppose we have a class A and with the help of it a pointer to a method is constructed, let typedef void (A :: * smthMethod) (). Is it possible to assign (leading to the type) smthMethod Method a reference to a function-method of another class B that is not related in any way to class A?

Re: Method pointers

Posted: Sat Jun 05, 2021 6:10 am
by xizer
Unfortunately, the awful architecture of C ++ does not allow you to do this simply ;)

Re: Method pointers

Posted: Sat Jun 05, 2021 6:52 am
by wazzcob
Hmm ... I looked for the answer, and it turns out that when classes are not related in any way, then they can not be brought at all?

Re: Method pointers

Posted: Sat Jun 05, 2021 7:03 am
by xizer
Even when tied up, you still can't.