Hello when i trying to compile this i've got errors in Mysz.cpp
:
error C2039: 'inicjatywa' : is not a member of 'Mysz'
error C2039: 'sila' : is not a member of 'Mysz'
error C2039: 'typ' : is not a member of 'Mysz'
error C2039: 'symbol' : is not a member of 'Mysz'
etc...
Organizm.h
#include "header.h"
class Swiat;
class Organizm
{
protected:
string typ;
char symbol;
int sila,inicjatywa, x,y;
Swiat *ref;
public:
Organizm() { symbol = ' '; };
}
Zwierze.h
#include "Organizm.h"
class Zwierze: public Organizm
{
public:
Zwierze() {};
public:
virtual int kolizja(Organizm& org) override
{
if(this->typ==org.getTyp()){return roz;}
else if(this->sila<org.getSila())return win;
else return loose;
};
virtual char akcja() override
{
char tab[4]={'p','d','g','l'};
int kierunek=rand() % 4;
return tab[kierunek];
};
};
Mysz.h
#ifndef MYSZ_H
#define MYSZ_H
class Swiat;
class Mysz: public Zwierze
{
public:
Mysz (int x,int y,Swiat *swiat);
public:
int kolizja(Organizm& org);
};
#endif
Mysz.cpp
#include "Mysz.h"
#include "Swiat.h"
Mysz::Mysz(int x,int y,Swiat *swiat)
{
this->typ="Mysz";
this->symbol='M';
this->sila=1;
this->inicjatywa=6;
this->x=x;
this->y=y;
this->ref=swiat;
};