I have two classes, commandparser and executor, in this design commandparser parses the command and calls the executecommand function of executor class,the executecommand returns immediately after setting few parameters, the command execution happens in ISR functions,after executing the command the results has to send back the parser via callback, the pseudo code:
class executor{
public:
void executeCommand(void){
//start Command execution, the command Execution takes place in some ISR functions.
}
private:
void command1(void){
//Call commandparser's sendresponse function.
}
void command2(void){
//Call commandparser's sendresponse function.
}
};
class commandparser{
public:
void sendresponse(int a){
//....
//...
}
void run(){
b.executeCommand();
}
private:
executor b;
};
int main(){
commandparser cmdparser;
cmdparser.run();
}
Is this possible to achieve?(The solution should not contain virtual functions as the I am working on embedded target where the RTTI are not allowed).