Greetings All,
I have one class I'll call main class and it creates and initializes all of the classes so that they are not re-created again. What I simply want to do is to have in the creation of my other classes pointers to the classes they need to operate.
I get errors when I try, and I have looked in various forums. The question is, how is the proper way to do this, if it can/should be done. I don't want to have to pass each one for each function that needs it. Thank you in advance for any help.
here is the class that creates the new classes
EcoAreaTeam* m_pEcoAreaTeam = new EcoAreaTeam();
LifePattern* m_pLifePattern = new LifePattern();
NeedTeam* m_pNeedTeam = new NeedTeam();
SceneFrameTeam* m_pSceneFrameTeam = new SceneFrameTeam(m_pEcoAreaTeam, m_pStatisticCalculation,
m_pSymptomManager, m_pTrioTeam);
StatisticCalculation* m_pStatisticCalculation = new StatisticCalculation();
SymptomManager* m_pSymptomManager = new SymptomManager();
TrioTeam* m_pTrioTeam = new TrioTeam();
here is a class that i trying to use to access pointers to these classes .cpp file
SceneFrameTeam::SceneFrameTeam(EcoAreaTeam* eco, StatisticCalculation* stat,
SymptomManager* sym, TrioTeam* trio):
m_pEcoAreaTeam(eco),
m_pStatisticCalculation(stat),
m_pSymptomManager(sym),
m_pTrioTeam(trio){}
here is the .h file creation information:
class EcoAreaTeam;
class SceneFrameBase;
class StatisticCalculation;
class SymptomManager;
class TrioTeam;
//these are the pointers to the classes
EcoAreaTeam* m_pEcoAreaTeam;
StatisticCalculation* m_pStatisticCalculation;
SymptomManager* m_pSymptomManager;
TrioTeam* m_pTrioTeam;
here is the constructor info:
SceneFrameTeam(EcoAreaTeam* eco,
StatisticCalculation* stat,
SymptomManager* sym,
TrioTeam* trio);
this is the error message:
error C2065: 'eco' : undeclared identifier
and
error C3867: 'SceneFrameTeam::EcoAreaTeam': function call missing argument list; use '&SceneFrameTeam::EcoAreaTeam' to create a pointer to member
the thing is I was looking at an example from Matt Buckland's AI book and he did not seem to need the &
I guess the question is, is there a simple way to do this?
Peace,
Marcia