Domanda

c->repo->findById(rid)   ;

What I want to do is to use the findById() function in a module by accessing it through c but the variable I'm trying to use is protected.Is there any way to specify that Control class is allowed to access that repo and the function which is found in MedRepo?Or is another method I could use to go there?I've tryed declaring a variable of type MedRepo but I get an vtable error for destructors and I can't geet rid of it.

ConsoleUI::ConsoleUI(Control *cu) {
    c = cu;
}

Definition of c and it's type

 class Control { ...
    protected:
        MedRepo* repo;
        MedValidator* validator;
    };
È stato utile?

Soluzione

you can either add a public getter for the repo pointer, or declare ConsoleUI as a friend of Control (and maybe of MedRepo as well, depends on the access level of findById() )

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top