Method pointers

Programmers and people with programming knowledge sit here
Post Reply
wazzcob
Posts: 24
Joined: Fri Feb 05, 2021 5:11 am

Method pointers

Post 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?
User avatar
xizer
Posts: 87
Joined: Mon Oct 05, 2020 9:51 am

Re: Method pointers

Post by xizer »

Unfortunately, the awful architecture of C ++ does not allow you to do this simply ;)
wazzcob
Posts: 24
Joined: Fri Feb 05, 2021 5:11 am

Re: Method pointers

Post 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?
User avatar
xizer
Posts: 87
Joined: Mon Oct 05, 2020 9:51 am

Re: Method pointers

Post by xizer »

Even when tied up, you still can't.
Post Reply