class Normal_Mode;
class Fast_Mode;
class File_Control; //handles all operations with reading/writing in file
class Main_Control {
private:
some_class *root; //all other classes need access to root pointer since there is all the data(binary tree)
File_Control *c_file_control;
Fast_Mode *c_fast_mode;
...
}
Main_Control::Main_Control ( int argc, char* argv[]) {
...
if ( argc > 1 ) {
c_fast_mode = new Fast_Mode(argc, argv[]);
} else {
c_normal_mode = new Normal_Mode();
};
...
};
int main (int argc, char* argv[]) {
Main_Control c_main_control(argc,argv);
return 0;
}
Lets say user input had argc > 1 and i am happy doing stuff with users input in Fast_Mode class but when i am finished and want to write stuff to file or read something from file while in Fast_Mode.
How do people in real world access File_control class?
Do they make some global array full with pointers to these kinda of classes who need only 1 instance.
Or pass pointers to Fast_Mode and other classes so it can have it stored in private members for access.
Or they construct/destruct such classes all the time depending on when it is needed.
And what do they do with such *root pointer where all the actual data is stored
Or my design ideas are completely wrong and people in real world do it some other way?