1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include<iostream>
#include<string>
class Monster
{
public:
printMonsterType()
{
//std::cout << static_cast<string>(Skeleton); //
}
printMonsterName()
{
std::cout<<m_name;
}
printMonsterRoar()
{
std::cout<<m_roar;
}
printMonsterHitPoints()
{
std::cout<<m_hit_points<<std::endl;
}
enum MonsterType
{
Dragon,
Goblin,
Ogre,
Orc,
Skeleton,
Troll,
Vampire,
Zombie,
MAX_MONSTER_TYPES
};
Monster(MonsterType _type, std::string name, std::string roar, int hit_points):
m_type(_type), m_name(name), m_roar(roar), m_hit_points(hit_points)
{
}
void print(){std::cout<<"here"<<std::endl;}
private:
MonsterType m_type;
std::string m_name;
std::string m_roar;
int m_hit_points;
};
void connect_frags(Monster &monster)
{
std::cout<<monster.printMonsterName();
std::cout<<"flag";
}
//Bones the skeleton has 4 hit points and says *rattle*
int main()
{
Monster monster(Monster::Skeleton,"Bones","Rattle",4); //when you make the constructor you make the object
connect_frags(monster);
return 0;
}
|