I am writing my first dungeon crawl game and I stumbled upon strange program behavior.
Board_level board; PlayerOn_Board player(0,0); board.setValues(20,20); //player.setPosition(10, 15); cout << player.returnX() << " " << player.returnY() << endl;
When I do "board.setValues(20,20)", player.returnX() and player.returnY() return 20s. I am expecting them both to be equal to zero since I declare them as zero and dont do any assigning. For some reason board object overwrites my player object. Can somebody please explain to my why it happens. I spent couple of hours trying to understand this.