#include <iostream>
#include <cmath>
#include <windows.h>
#include <cstdlib>
#include <ctime>
#include <string>
#include <cstdio>
#include<conio.h>
using namespace std;
int losowanie(int a){
srand(time(NULL));
return rand()%a;
}
void tekst(string a, int b){
for(int i=0;i<a.length();i++){
cout<<a[i];_sleep(b);
}
}
class item
{
int item_ID;
string item_name;
int item_weight;
friend class backpack;
public :
item(int item_ID,int item_weight,string item_name)
{
this->item_ID = item_ID;
this->item_weight = item_weight;
this->item_name = item_name;
}
int get_weight()
{
return item_weight;
}
string get_name()
{
return item_name;
}
int get_id()
{
return item_ID;
}
void set_id(int id)
{
item_ID=id;
}
void set_weight(int a)
{
item_weight = a;
}
void set_name(string a)
{
item_name = a;
}
};
class backpack
: public item
{
item slot[100];
int max_weight;
int current_weight;
public :
void item_add(item stuff)
{
item *marker;
marker = &slot[0];
int loop=1;
while (loop==1)
{
if (*marker.get_id()==NULL)
{
if ((current_weight+item :: stuff.get_weight())>max_weight)
{
string imie; //ten string jest definiowany w mainie i tylko podmieniana jest zawartosc;
cout<<endl;
cout<<imie<<endl;
string talk;
talk = "Nie dam rady tyle podniesc";
tekst(talk,60);
loop=0;
}
else
{
item::*marker.set_id(item ::stuff.get_id());
item:: *marker.set_weight(item :: stuff.get_weight());
item:: *marker.set_name(item ::stuff.get_name());
loop=0;
}
}
else
marker++;
}
}
};
class person
{
backpack plecak;
string person_name;
person(string person_name)
{
this->person_name = person_name;
}
void item_add(item stuff)
{
plecak.item_add(stuff);
}
};
main ()
{
item mieczyk(1,2,"mieczyk");
person krystian("krystian nie umie programowac");
krystian.item_add(mieczyk);
}
Witam, program wywala blą w linijce class backpack no matching function for call to class.
Dla wszelkiej pewności osób zaawansowanych jak widać mój staż w programowaniu jest ekhm... dość krótki :)
Proszę o wyjaśnienie co zrobiłem źle.