RPG Inventory

Hey guys, the program I'm trying to write is for a hw assignment. Unfortunately, I wasn't able to make it to a lecture that spoke specifically about this project. Anyways, I'm supposed to write a program that doesn't require UI for the player. Instead, it's simply printed but the professor wants to see the details of an inventory system.

The first steps are to create the "item: class with a constructor that will take in a char* name and a double weight but I don't understand how this will help in the later coding. I mean.. I understand that constructors are used to set a default value but i don't know how it would be used to describe the name of an item. The next class I'm supposed to build is "inventory." This class is supposed to have a linked list that will carry all the items. I have tried searching and learning these topics, but I can't manage to construct a code that meet my professor's specifications.

Here is the code so far..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using namespace std;

int maxWeight;

class inventory {  //manages the entire inventory
public:
    inventory();
    inventory::inventory(int defaultWeight = maxWeight);

private:
    int maxWeight = 100;


};

class item {  //holds the details about a particular item
public:
    item();
    item(char* name, double weight);    
private:
    char* name;
    double weight;
};


I do hope you can help. Thank you.
Topic archived. No new replies allowed.