Mam napisac program taki jak w temacie. Istnieja 3 klasy Aplikacja, Dokument i obiekt. Obiekt bedzie wybranym ksztaltem geoometrycznym, dokument ma pozwalac dodawac obiekty i exportowac je do svg. Na początek mam problem z tym jak przechowywac juz utworzone obiekty w klasie dokument? stworzyc jakas ich tablice ? na razie mam cos takiego:
#define TEST
#include <iostream>
#include <string.h>
#include <fstream>
#include <list>
class Aplikacja{
private:
public:
};
class Obiekt{
private:
std::string typ, cx, cy, x, y, x2, y2, kolor, rx, ry, r,dlugosc,szerokosc;
public:
Obiekt(std::string typ, std::string x, std::string y, std::string dlugosc, std::string szerokosc, std::string kolor) //konstruktor prostokata
{
this->x=x;
this->y=y;
this->typ=typ;
this->dlugosc=dlugosc;
this->szerokosc=szerokosc;
this->kolor=kolor;
#ifdef TEST
std::cout << "konstruktor prostokat\n";
#endif
}
Obiekt(std::string typ, std::string cx, std::string cy, std::string r, std::string kolor) //konstruktor kola
{
this->cx=cx;
this->cy=cy;
this->typ=typ;
this->r=r;
this->kolor=kolor;
#ifdef TEST
std::cout << "konstruktor kolo\n";
#endif
}
~Obiekt(){
#ifdef TEST
std::cout << "destruktor obiekt\n";
#endif
}
};
class Dokument : public Obiekt{
private:
public:
};
int main()
{
Obiekt kolo("kolo","2","3","4","red");
Obiekt prostokat("prostokat","20","3","12","13","czarny");
return(0);
}