class Boundary;
class Shop
{
Shop(Boundary& b) : shopBoundary(&b) {}
Boundary& shopBoundary;
};
class Game
{
public:
Game() :shop(components["shop"]) {}
private:
std::map<std::string,Boundary> components;// the content is going to be loaded from file
void load()
{
//load components from file
}
Shop shop;
};
as you can see, i'd have to make the shopBoundary reference because its value (from component) is going to be loaded after the constructor is executed so in that case i wont be able to intiialize it.
im thinking another way of making a setter for it.
so which one do you think will be the best or is this just a matter of preferences?