I'm trying to simply add an object to another object within a class, for example add player to factory.
For my factory.h
class Factory
{
public:
Factory(void);
~Factory(void);
void addMaze(Maze maze);
void addPlayer(Player player);
std::string getSessionTime();
std::string setSessionTime(std::string time);
private:
int m_ID;
Player m_player;
Maze m_maze ;
std::string m_SessionTime;
std::string m_filePath [50];
};
and then in my Factory class I have:
void Factory::addPlayer(Player player)
{
m_player.add(player); //This is what I feel like I want to do
}
So, I'm trying to add a Player to my list of Players, but this won't do it? Am I missing something really obvious? If anyone could help or point me in the right direction I would really appreciate it.
std::vector<Player>as a member variable of the classFactory.playerinstance in theFactorywon't be the same as the one whichaddPlayerwas called with. It's a copy.