Passing variables into a function

ok I have a class Player with lots of variables and im gonna call a function to checkXp, if I call it with the whole player object does it use a lot more memory then if I just passed the couple things I need?

ex
checkXP(Player* play) // this is a whole object of player

or

checkXP(play->getXP(), play->getLVL()) // the variables I want.
I just realized I may not be able to modify anything from player in the checkXP() function

question 1: does passing the whole object use more memory
question 2: if I passed as just the variables I need, I wont be able to modify anything of object play?
morngrym wrote:
question 1: does passing the whole object use more memory

You are not passing the whole object. You are just passing a pointer to the object so it's nothing to worry about.

morngrym wrote:
question 2: if I passed as just the variables I need, I wont be able to modify anything of object play?

Correct, unless you pass the variables by reference or you have some other way to access the object.
Topic archived. No new replies allowed.