I'm trying to write a basic RPG style battle system to practice classes, but I'm having a little trouble with creating an inventory system.
To keep things simple, I want to restrict the items to Weapons, Armour and Items.
Originally I thought of making a class Item, and instantiating all items from this class. But this appears to be quite messy, as the constructor for each item would take a dozen or so arguments, such as name, type, value, weight etc, and even messier again when you consider an item of "weapon" type might contain a variable for modifying damage, which is irrelevant to an item of type "potion" or "armour".
So, my next idea was to have separate classes for Weapons, Armour and Potions. That way member variables are relevant to the type of item, and each instance will only require a couple of arguments, which seems more manageable.
However, how can I wrap different classes up into an inventory within a Player class, so that items can be added, removed and listed? Is it possible to have a vector of different Class types? Is there a solution within class templates?
I'm not looking for anybody to write the code, just to point me in the right direction.
*EDIT*
I should probably go back to this post for anybody similarly stuck, and mention that using virtual functions let me achieve what I was trying to do. MiiNiPaa posted an example here:
http://www.cplusplus.com/forum/beginner/142695/