Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace::std;
- enum class Material
- {
- bawelna,
- welna,
- jedwab,
- poliester
- };
- enum class Kolor
- {
- bialy,
- czarny,
- czerwony
- };
- enum class Wzor
- {
- paski,
- kratki,
- grochy
- };
- enum class Rodzaj
- {
- spodnie,
- bluza,
- sukienka
- };
- class Ubranie
- {
- public:
- Material material;
- Kolor kolor;
- Wzor wzor;
- Rodzaj rodzaj;
- Ubranie()
- {
- ilosc++;
- }
- Ubranie(Material material, Kolor kolor, Wzor wzor, Rodzaj rodzaj)
- {
- this->material = material;
- this->kolor = kolor;
- this->wzor = wzor;
- this->rodzaj = rodzaj;
- ilosc++;
- }
- virtual ~Ubranie();
- static void Ilosc()
- {
- cout << ilosc << endl;
- }
- friend ostream& operator<<(ostream& os, Ubranie& temp)
- {
- os << "Material: " << temp.material << endl;
- os << "Kolor: " << temp.kolor << endl;
- os << "Wzor: " << temp.wzor << endl;
- os << "Rodzaj: " << temp.rodzaj << endl;
- return os;
- }
- private:
- static int ilosc;
- };
- Ubranie::~Ubranie()
- {
- ilosc--;
- }
- int Ubranie::ilosc = 0;
- class Spodnie : public Ubranie
- {
- public:
- int dlugosc;
- int obwod_w_pasie;
- Spodnie();
- Spodnie(Material material, Kolor kolor, Wzor wzor, int dlugosc, int obwod_w_pasie)
- {
- this->material = material;
- this->kolor = kolor;
- this->wzor = wzor;
- this->rodzaj = Rodzaj::spodnie;
- this->dlugosc = dlugosc;
- this->obwod_w_pasie = obwod_w_pasie;
- }
- };
- class Sukienka : public Ubranie
- {
- public:
- int dlugosc;
- int obwod_w_klatce;
- Sukienka(Material material, Kolor kolor, Wzor wzor, int dlugosc, int obwod_w_klatce)
- {
- this->material = material;
- this->kolor = kolor;
- this->wzor = wzor;
- this->rodzaj = Rodzaj::sukienka;
- this->dlugosc = dlugosc;
- this->obwod_w_klatce = obwod_w_klatce;
- }
- };
- class Bluza : public Ubranie
- {
- public:
- int obwod_kolnierza;
- int dlugosc;
- int obwod_w_klatce;
- Bluza(Material material, Kolor kolor, Wzor wzor, int obwod_kolnierza, int dlugosc, int obwod_w_klatce)
- {
- this->material = material;
- this->kolor = kolor;
- this->wzor = wzor;
- this->rodzaj = Rodzaj::bluza;
- this->obwod_kolnierza = obwod_kolnierza;
- this->dlugosc = dlugosc;
- this->obwod_w_klatce = obwod_w_klatce;
- }
- };
- class Kuloty : public Spodnie
- {
- public:
- friend ostream& operator<<(ostream& os, Kuloty& temp)
- {
- os << "Rodzaj spodni: " << "Kuloty" << endl;
- return os;
- }
- };
- class Marchewy : public Spodnie
- {
- public:
- friend ostream& operator<<(ostream& os, Marchewy& temp)
- {
- os << "Rodzaj spodni: " << "Marchewy" << endl;
- return os;
- }
- };
- class Cygaretki : public Spodnie
- {
- public:
- friend ostream& operator<<(ostream& os, Cygaretki& temp)
- {
- os << "Rodzaj spodni: " << "Cygaretki" << endl;
- return os;
- }
- };
- class Szwedy : public Spodnie
- {
- public:
- friend ostream& operator<<(ostream& os, Szwedy& temp)
- {
- os << "Rodzaj spodni: " << "Szwedy" << endl;
- return os;
- }
- };
- class Jeansy : public Spodnie
- {
- public:
- friend ostream& operator<<(ostream& os, Jeansy& temp)
- {
- os << "Rodzaj spodni: " << "Jeansy" << endl;
- return os;
- }
- };
- class Chinosy : public Spodnie
- {
- public:
- friend ostream& operator<<(ostream& os, Chinosy& temp)
- {
- os << "Rodzaj spodni: " << "Chinosy" << endl;
- return os;
- }
- };
- int main()
- {
- Ubranie temp(Material::bawelna, Kolor::bialy, Wzor::paski, Rodzaj::spodnie);
- Ubranie::Ilosc();
- //temp.~Ubranie();
- //Ubranie::Ilosc();
- //Ubranie temp(bawelna, bialy, paski, spodnie);
- cout << temp << endl;
- Spodnie temp_1(Material::bawelna, Kolor::bialy, Wzor::paski, 5, 5);
- Ubranie::Ilosc();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement