Witam
Mógłby mi ktoś wskazać gdzie mam błąd w programie
#include <iostream>
#include <vector>
using namespace std;
class BazaFigur
{
protected:
double length;
/*char *nazwa;*/
double x;
double y;
public:
virtual void sprawdzczyzawiera(vector<BazaFigur*>zbior,double length,double x,double y);
virtual bool czy_zawiera(double length,double x, double y) = 0;
virtual double arena() = 0;
virtual double obwod() = 0;
virtual void wyswietl();
};
class kwadrat :public BazaFigur
{
public:
bool czy_zawiera(double length,double k, double l){
if (k>x && k<x + length && l<y && l>y - length) return true;
else return false;
}
friend void sprawdzczyzawiera(vector<BazaFigur*>zbior, double length, double x1, double y1);
void wyswietl()
{
cout << this->length << endl;
}
kwadrat(double length ,double x,double y)
{
this->length = length;
this->x = x;
this->y = y;
}
double arena()
{
return this->length*this->length;
}
double obwod()
{
return this->length * 4;
}
};
void sprawdzczyzawiera(vector<BazaFigur*>zbior, double length, double x1, double y1)
{
for (int i = 0; i < zbior.size(); i++)
{
if (zbior[i]->czy_zawiera(length, x1, y1) == true)
{
zbior[i]->wyswietl();
}
}
}
int _tmain(int argc, _TCHAR* argv[])
{
vector<BazaFigur*>zbior;
zbior.push_back(new kwadrat(7,78,56));
zbior.push_back(new kwadrat(9,55,65));
sprawdzczyzawiera(zbior,7,7, 8);
}