help with Game

Nov 21, 2020 at 10:53pm
Hello guys,
I need a help im doing text adventure and i need create inventory by using vectors.I need to create item class than create some gun(polymorphism and some key and than add them into inventory but idk how to do it, can someone help me ?

1
2
3
4
5
6
7
8
9
  #include <iostream>

class Inventory {
    std::vector<>
public:
    void displayInv();
    void add();
    void remove();
    void inventory();
Nov 22, 2020 at 2:52am
1
2
3
4
5
6
7
8
9
10
11
class Item; // Forward declaration

#include <vector>
class Inventory {
    std::vector<Item>
public:
    void displayInv();
    void add();
    void remove();
    void inventory();
};


The Item class now awaits you gun and whatever inheritance, polymorphism and methods stuff
Topic archived. No new replies allowed.