This is my function:
void load(int *money, int *exp)
{
int mon, xp;
ifstream savefile("save.txt");

if (savefile.good())
{
savefile >> player.maxhp;
savefile >> player.maxmp;
savefile >> player.atk;
savefile >> player.def;
savefile >> player.magatk;
savefile >> player.magdef;
savefile >> mon;
savefile >> xp;
(*money) = mon;
(*exp) = xp;
}
else
{
cout << "There was an error opening the file. Either the data was corrupted or the \"save.txt\" file is not in the same folder as the game file" << endl;
}
savefile.close();
}

I can get the function to use the members of a class, but i must put "player" after the class eg.

class knight
{
public:

int maxhp, maxmp, atk, def, magatk, magdef;

knight() :
maxhp(100),
maxmp(100),
atk(10),
def(10),
magatk(10),
magdef(10)
{}
}player;

This is good, but i want the function to be able to use the "player.(member)" even if i dont put the "}player;" at the end of the class. Is there a way to do this?