I have a class Player, with a an object player_1, and an another class Weapon.
From my object player_1 i call a method who is located in class Weapon player_1.getWeapon().changeDurability(int x)
void changeDurability( int x) {
// changing durability
// and then i want to do something like this :
if( durability <= 0) player1.setWeaponBroken(true)
}
But i don't know how to get the player1 from the Weapon object,
and is there a way to do this instead of changing the method to something like this:
void changeDurability(Player player, int x)
Thanks in advance for any helping answers.