Hi I am learning how to implement state machine in c++ at the moment, and I don't really understand what I give to my function with this following code :
void promptfornextevent(elevatorstate& state, int event){
std::cout<<"Current State = "<< state.Description() << std::endl;
}
And I call it like this in the main function :
int main(){
...
elevatorstate* currentstate = new state_1stfloor;
promptfornextevent(*currentstate, event);
...
}
I don't understand the point using reference on the line elevatorstate& state. What exactly does my function receive from the main function? I thought that I give my function an object (pointed by the currentstate)