Hiya
I am trying to make a text based game, and have come across a hard decision whilst planning the enemies, players and items. Should I make an abstract class and then have each enemy derived from that with its skills defined in the constructor, or do I just make an enemy class and have a constructor which takes in the skills and makes it from those and keep them in typedefs.
Example:
Choice a)
class Enemy
{
public:
Enemy();
Attack();
(other stuff)
};
class Rat : public Enemy
{
public:
Rat()
(other stuff, only override stuff like Attack if I want something special to happen)
};
Choice b)
class Enemy
{
public:
Enemy(int str, int def, int health)
(other stuff)
}
(I've forgotten the exact syntax for this)
typedef Enemy(2,3,10) Rat;
Whether you think you can or think you can’t, you’re probably right – Henry Ford