class battle
{
public:
class monster zombie;
int monhealth = zombie.health(0);
void start(char monster2[])
{
while ( monhealth > 0 && mitchell.health() > 0 )
{
space(1);
cout << "You are ATTACKED by a " << monster2 << " with " << monhealth << " HP!" << endl;
if (weapon == 0)
{
noWeapon();
} elseif (weapon == 1)
{
knife();
} elseif (weapon == 2)
{
sword();
}elseif (weapon == 3)
{
bow();
}
}
}
}
This is the line is is giving the error
while ( monhealth > 0 && mitchell.health() > 0 )
Thanks for your help! If this is too confusing, i can post the entire code. Basically im trying to generate a random health value that is consistant within the player class, which i can then access and modify through an object, if that makes sense. Im very new to OOP. Thanks :D