Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ callback for non-static function between different classes
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COA non-static member function has to be called upon a concrete object of class B, C, .... Not sure what you are after. If I understand correctly, your system interact with object of class A without knowledge of class B, C, D. Then it is impossible to have A call a non-static member of B, etc unless either B derived from A, and the system interact with a B class object through A pointer, by virtual functions or CRTP; Or A has a B class sub object. Either way, your system has to know a B class concrete object to call its non-static member
      singulars
    2. COThe class A will provide a mechanism (public function) to set the callback function. And class B,C,... will also have a object of class A. So, after the class B,C,.. has set the function and after a particular event is detected by class A, the class A should be able to call the function set by B,C,...
      singulars
    3. COI think it is impossible. If {B, C, ...} does not share some hierarchy, for example, all derived from A, how could A know which type of the object the callback shall be called upon? You can pass member function pointers to A, but A need to know the type B to call it. If A has B or C, etc, then it will be possible. But it is not the case in your question.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload