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.
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.
My computer is awesome.
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
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
But since this is C++, you should be using classes.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
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.Originally Posted by Salem
You haven't looked into I/O streams much, have you?Originally Posted by fsp