Hi,
I am hoping for some general advice on how to create a user interface, by use of a processor class.
The program I am creating uses inheritance.
I am creating the following functionalities:
addACar();
deleteACar();
editACar();
searchForACar();
loadCarsToCSVFile();
saveCarsToCSVFile();
exitTheProgram();
viewNextCar();
viewPreviousCar();
showHelp();
Until now I have only ever used a single main.cpp and a single base.h file.
My question is where should I locate these functions so that I create a user interface using a processor class.
I thought about it for a while, and came up with the following:
Functions to be implemented within main.cpp:
exitTheProgram();
viewNextCar();
viewPreviousCar();
showHelp();
Functions to be interfaced in 'base.h' and implemented within 'base.cpp':
addACar();
deleteACar();
editACar();
searchForACar();
loadCarsToCSVFile();
saveCarsToCSVFile();
The reason I am somewhat confused is because of reasons such as the following:
1) Surely exitTheProgram(); should completely be within main() right? No part of it needs to be inside base.h or base.cpp.
All the function does is call exit(0);
2) viewNextCar(); and viewPreviousCar(); will iterate though a std::list. So should these functions we located within main() to? There is no use of constructors/destructors.
//-------------------
Am I wrong with this do you think?
Should EVERY function have an interface inside base.h?
Or should I go ahead and place (for example) exitTheProgram(); within main() ?
I understand it's difficult to give specific advice without seeing the program, but if anyone can help clarify how one should implement a processor class and create a 'single' user interface that would be brilliant.
I've read the pages I've found in Google describing inheritance, virtual member functions etc, but I'm still confused about the general method of creating one.
Many thanks!