I am taking my first C++ college class and we are learning the callback concept. I have the code below that is actually working (it is a callback code that responds to a button click), were "pancakesScreen" is a global variable but I need to define it locally at some point in the code. If I define it locally then my code below will not work so I suppose that it can be passed as an argument. Is it possible to pass it as an argument/parameter? If so, how?
Shouldn't it work simply to pass pancakesScreen by reference(or a pointer to it)? Assuming you have access to the screen object locally in the calling function.