I need to store the info for all the items and weapons. Such as the the profiencies of the weapon and what to display in the inventory. I was just wondering if structures is the right way to go. :confused:
Printable View
I need to store the info for all the items and weapons. Such as the the profiencies of the weapon and what to display in the inventory. I was just wondering if structures is the right way to go. :confused:
Yes... Using structures would be a correct implementation (from a design standpoint). Since you have groups of data which are logically connected, you can make the connection explicit by using a structure to encapsulate the data.
That said, there are many ways to implement what you want to do using structures, some are better than otehrs, but a lot depends on the design of the rest of your program, and how "fancy" you want to get with your structures.
Cheers
But since this is C++, you should be using classes.
I don't agree with you totally there. You have to look from a designer's point of view. Yes, you could use classes to store just data but that's kind of strange. Grouping data does not fit into object oriented programming. I consider groupings of data as records and not objects. Also you would have to give the data members in a class public access. More work! And one might forget to do so. Structures are the way to go if you are working with records or blocks of data. I don't think C++ intended the programmer to use classes for reading blocks of data.Quote:
Originally Posted by Salem
You haven't looked into I/O streams much, have you? ;)Quote:
Originally Posted by fsp