immanuelx2
June 19th, 2008, 06:45 PM
class Mob
{
public:
Mob(int hp = 50, string name = 'Boar'); //if nothing is set, default to 50
int getHP() const;
string getName() const;
int dmg();
private:
int m_HP;
string m_Name;
};
Mob::Mob(int hp, string name):
m_HP(hp),
m_Name(name)
{
cout << "--" << getName() " created with " << getHP() << " HP" << endl << endl;
}
inline int Mob::getHP() const
{
return m_HP;
}
inline string Mob::getName() const
{
return m_Name;
}
inline int Mob::dmg()
{
m_HP = m_HP - 14;
if (m_HP <= 0) { cout << "you killed it!" << endl; }
else getHP();
}
any ideas?
error is on the line cout << "--" << getName() " created with " << getHP() << " HP" << endl << endl;
thanks in advance!
{
public:
Mob(int hp = 50, string name = 'Boar'); //if nothing is set, default to 50
int getHP() const;
string getName() const;
int dmg();
private:
int m_HP;
string m_Name;
};
Mob::Mob(int hp, string name):
m_HP(hp),
m_Name(name)
{
cout << "--" << getName() " created with " << getHP() << " HP" << endl << endl;
}
inline int Mob::getHP() const
{
return m_HP;
}
inline string Mob::getName() const
{
return m_Name;
}
inline int Mob::dmg()
{
m_HP = m_HP - 14;
if (m_HP <= 0) { cout << "you killed it!" << endl; }
else getHP();
}
any ideas?
error is on the line cout << "--" << getName() " created with " << getHP() << " HP" << endl << endl;
thanks in advance!