lvalue required as left oprand error

hey guys i need some help with my code i luked up solutions online bt ddnt find any solution am adding points to my player by two everytime the enemies are shot bt am getting this error lvalue required as left oprand and dont know whats wrong. please help and thanx in advance..
am using a get function to retrieve points from my player class

 
 player1.getPoints() = player1.getPoints()+2;
Last edited on
I don't know how you have defined you function....but It looks like if your function doesn't get anything like argument I can't see the logic of adding two points...and a lvalue is a place to hold the information....as you are assigning you should provide somewhere to keep that information...
thanx for the reply i got it to work by passing my get function by reference
1
2
3
4
 
// player points
    void setPoints(int );
    int &getPoints();
Topic archived. No new replies allowed.