Suppose I have the following struct:
struct Dimension { void setDimension(Vector2i dim); Vector2i getDimension() const; bool canShowInformation(); } And this struct uses the Dimension struct:
struct ApplicationState { Dimension dim; State currentState; //Delegate everything to Dimension struct. void setDimension(Vector2i dim) { dim.setDimension(dim); } Vector2i getDimension() const { return dim.getDimension(); } bool canShowInformation() { return canShowInformation(); } } Is it bad to wrap almost all methods of Dimension struct in the ApplicationState struct? I do this so that I won't have long method calls like this:
appState.dim.setDimension(...) //or appState->dim.setDimension(...) Is there a design principle or pattern which solves this problem?
Thanks in advance.
Dimension. If for exampleÀpplicationStatewill have 10 methods at the end and only three of them are delegations toDimensionshould I inherit from ````Dimension```?dim.setDimension(...).