OK, what I'm going to try and do is finish up this game and then do my best to learn more about classes in C++. I really don't understand what you mean by "pass it" and I did try to Google it but I'm not really sure what exactly I would Google.
This is the code for GameManager::MainManager:
Code:
void GameManager::MainManager()
{
while (true)
{
system("CLS");
cout << "Current Status:\n";
cout << "Money: $" << money << "\n";
cout << "Lives: " << lives << "\n";
cout << "Attack Points: " << attack << "\n";
cout << "Defense Points: " << defense << "\n";
cout << "Would you like to visit the shop or battle robots?\n(Please enter either Shop or Battle)\n";
cin >> ShopBattle;
system("CLS");
if (ShopBattle == "Shop" || ShopBattle == "shop") {
Shop.ShopMain(GameManager& manager);
} else if (ShopBattle == "Battle" || ShopBattle == "battle") {
Battle.BattleMain(GameManager& manager);
} else {
cout << "\nError: Invalid Input\n\n";
cout << "The Program Will Now Exit\n\n";
system("PAUSE");
}
}
}
.. and this is how I declared the shop and battle methods:
Code:
void ShopClass::ShopMain(GameManager& manager)
and when I initialized the methods in the header file, I did:
Code:
public:
void ShopMain(GameManager& manager);
and I did put above the two classes (shop and battle) in the header files.
This is the error I'm getting:
Code:
GameManager.cpp: In member function `void GameManager::MainManager()':
GameManager.cpp:27: error: expected primary-expression before '&' token
GameManager.cpp:27: error: `manager' undeclared (first use this function)
GameManager.cpp:27: error: (Each undeclared identifier is reported only once for each function it appears in.)
GameManager.cpp:29: error: expected primary-expression before '&' token