I'm writing an App class which incorporates the various elements that form and make a console application work. These elements are classes such as Window, Console, Cursor, InputHandler that have methods to operate on what they represent. I'm having trouble choosing between three designs: the first one is having an App class whose members are private which has it's own public methods that are used to access the members relative methods. Ex:
class App
{
public:
App();
void setWindowPos(...);
void setWindowSize(...);
Coords getWindowPos();
Coords getWindowSize();
void setConsoleBufferSize(...);
Coords getConsoleBufferSize(...);
// etc..
private:
Window window;
Console console;
Cursor cursor;
InputHandler input_handler;
// etc
};
class Window
{
public:
Window();
void setPos(...);
void setSize(...);
Coords getPos();
// etc
};
This would cause the definition of multiple functions that have the same utility just to access the very function which does that thing, expecially if these members have in turn other private members which methods you want to be accessible from the App class (ex. calling App::setWindowPos() which in turn calls Window::setPos() instead of directly calling the latter).
The second design is the one where you have the App members representing the various elements of an application public, so that you can directly access their methods from App objects. Ex:
class App
{
public:
App();
// etc..
public:
Window window;
Console console;
Cursor cursor;
InputHandler input_handler;
// etc
};
class Window
{
public:
Window();
void setPos(...);
void setSize(...);
Coords getPos();
// etc
};
The third design is having App members private, but having getters methods which return references to these private App elements.
Which design is the more sensible?
Note: I want the various classes like Window, Console, Cursor etc to be usable alone, also outside of a App class.