error C2065: 'money' : undeclared identifier
These errors are for the constructor. Obviously, I can't assign variables to private member unless I want them to be constant, right? So what to do?
- Code: Select all
class Loser
{
public:
Loser(int startEnergy, int startMoney):
energy(startEnergy),
money(startMoney)
{
};
private:
int energy;
int money;
};
int main()
{
Loser Thang(90, 75);
Thang.drinkCafe(5,5);
return 0;
}
void drinkCafe(int negEnergy, int negMoney)
{
energy -= negEnergy;
money -= negMoney;
}
