For example, I have two classes, Game and Logic. Game has-a unique pointer to an object named m_Logic.
class Game {
public:
Game(){}
private:
std::unique_ptr<Logic> m_Logic;
}`
class Logic {
public:
Logic()
bool Run(Game &pGame) {
pGame.GetObjectPtr().DoStuff() return true;
}
In the Logic Class I use a method referring to the Game object, so ultimately I can call:
this->m_Logic->Run(*this);
From within the Game Class, and not have to constantly pass in individual object references coming from the Game Object itself, into it's components when I need the component to do its work while knowing about what Game contains.
Since they are both dependent on each-other in this case, what alternatives can be made to keep them as independent as possible, but still know about one another to work with while following good design practice? And my goal is to do this without having to declare references of the same individual objects that the game has and keeping parameters as clean as possible.
Thanks all in advance.