   Strings vs Objects
  Howdy!I am working on an RPG and I have several classes to represent things.  I am using a map to store everything (and I have implemented a system where data is read from a file and assigned to an object) with a string as the key.My question is, in my character class, should I store things like Items as strings or objects themselves?  If I store it as a string I can just access it easily via the map, and if I store it as an object I can bypass that step, but Im not sure if I'm using more CPU.Thanks in advance!   
  Store them by strings initially as they are far easier to manage. If into your development you find it is a serious bottleneck then change it over to the items themselves.Personally, I would create an "ObjectHandle" class which contains one object. Internally it can either store objects or strings. If you design the interface carefully enough you will be able to change the internal workings without having to modify any code that uses the ObjectHandle class.Just a thought.   ;  Wait, what do you mean?  So do I make a struct that is used that contains or the other, and I can change it at will?  Hm.. not sure how that would be different, but can you explain more?Also how are strings easier to manage than objects?  For each object I have a filename data member (string) which represents the key in which the map has stored it, so I can get the string easily.  I was curious which was more CPU taxing?   ;  It is not completely clear what you are trying to do. Does the map contain all the objects in the world, or all the types of objects in the world. I am assuming it is the latter, and you are asking which way is better for keeping track of objects owned each character: the character contains keys (as strings) to the types in a map, or the character contains intances of the object types in the map. Right?In that case, the character probably should contain objects, simply because an object may have data that is not shared by all objects of its type (such as whether the item needs to be repaired or not).Your question was specifically about performance, but MENTAL's reply ignored that because performance at such a minute level is not a priority at this stage. Design, organization, flexibility, consistency, robustness, and correctness are more important.   ;  Ah, John, you're great!  I did not even consider that a player's objects might and will be unique to the "base" object!  Thanks!   