Witam oto kod
class postac;
class item
{
friend class postac;
public:
string nazwa;
int ID;
char cel;
int waga;
int cena;
int attack;
int defensywa;
int obrona;
int hp;
int mana;
item(string nazwa1, int id, char why,int weigh, int a=0, int ob=0,int def=0, int p=0,int h=0, int m=0)
{
nazwa=nazwa1;
ID=id;
waga=weigh;
cel=why;
waga=weigh;
attack=a;
obrona=ob;
defensywa=def;
cena=p;
hp=h;
mana=m;
}
int return_item_waga(int id){
return ( id ).waga;
}
};
mam takie pytanie jak widac chce stworzyc funkcje return_item_weight i tam podaje id
kazdy przedmiot ma swoje id a nazwa obiektu to jego id no wiecie item 1(miecz) ;
jak zrobic zebym mogl w tej funkcji zapisac wlasnie takie id . waga tyle ze id to jest ten int co podaje w funkcji return_item_weight
i ja