mercredi 27 février 2019

Is there any good solution to resolve cross-reference between two class in c++?

My use case is following

class Caller
{
  init(){ Callee.init(); }
  callMeByCalle() { //do something }
}

class Callee
{
  init(){ //initialize to receive IPC call from another process }
  onHandlerIPC { //call A class's callMeByCalle() in here }
}

Maybe I can pass the instance of A class when I call init() of Callee. But I think it could cause a cross-reference problem. Is there any formal or famous solution for this situation?

Aucun commentaire:

Enregistrer un commentaire