I am making a C ++ application that runs a simulation for a health club. The user simply enters the simulation data at the beginning (3 integer values) and starts pressing. After that there is no user input - it's that simple.
After starting the simulation, most of the logic is in the deep lower class, but many of them have to print simple output messages in the user interface. It is not possible to return a message because objects must print in the user interface, but continue to work.
I was going to pass a reference to the user interface object for all the classes that need it, but I end up passing it quite a lot - there should be a better way.
What I really need is what can make calling the printOutput (string) function of the user interface simpler (or not much more complicated) than cout <<string
The user interface also has a displayConnectionStatus (bool []) method.
Remember that the user interface inherits from the abstract class UserInterface, so the simple and simple console user interfaces and graphical interfaces can be easily changed.
How do you suggest me to implement this link in the user interface?
If I used a global function, how can I redirect it to the methods of invoking the UserInterface implementation that I chose to use?
source share