viewing a text string for a member of a class....
ok... I have a class called cMob. I have members of the class ie cMob troll.... I also have a member called currentMob. For instance, if the monster the user is fighting is a troll, then currentMob = troll... I need to display the text "troll". Anyone know how I can do this? Here is all the sourcecode for my monsters.....
Code:
//class of monsters
class cMob
{
public:
int attack;
int itsAttackPower;
int itsHP;
char itsName;
};
// All this monster stuff is in a function call fight()
//Monsters
cMob currentMob;
cMob rabbit;
cMob rat;
cMob sTroll;
cMob lTroll;
cMob dragon;
cMob boss1;
//monsters damages
rabbit.itsAttackPower= 1;
rat.itsAttackPower = 3;
sTroll.itsAttackPower = 6;
lTroll.itsAttackPower = 8;
dragon.itsAttackPower = 12;
boss1.itsAttackPower = 30;
//monsters Health
rabbit.itsHP = 4;
rat.itsHP = 7;
sTroll.itsHP = 15;
lTroll.itsHP = 25;
dragon.itsHP = 40;
boss1.itsHP = 80;