I have written a program that has a class with a constructor and destructor written with couts and cins.
The class contains a run() function which I am using as my menu. From the menu, I want to have the user select the option to 1. Test the constructor (creates an instance from the class) and 2. Test the destructor (exits the menu and destructs at the end of main).
Here is my dilemma.
In main() in order for me to use the run() function, I have to create and instance of the class. However, I am using templates. ie. Class<classType> classTypeRun.
In order for me to create an instance to be able to use run() I have to specify a classType, and this will call the constructor, which I do not want. I only want the constructor to run when the user selects it from the menu.
What is the most efficient way to go about this?
Should I create an inheritaned class just for the run() function?
Make
run()a free function, like this: