showInventory(player); passes the type as a parameter. This is illegal, you need to pass the object.
For example, something like:
player p; showInventory(p);
I assume you have something like this:
int main() { player player; toDo(); }
which is terrible. First, do not name the object the same as your type. Secondly, in order for the object to be visible inside the function, you need to pass it as a parameter:
int main() { player p; toDo(p); }
and
std::string toDo(player& p) {
source share