Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<list>
- #include<vector>
- #include<string>
- #include<cstdlib>
- #include <cstddef>
- using namespace std;
- class Towar {
- protected:
- string cena;
- string nazwa;
- string opis;
- public:
- Towar(){}
- Towar(float cena, string nazwa, string opis)
- {
- this->cena=cena;
- this->nazwa=nazwa;
- this->opis=opis;
- }
- virtual void podsumuj(){};
- };
- class Urzadzenie : public Towar {
- protected:
- string nazwa_producenta;
- public:
- int a;
- Urzadzenie(string nazwa_producenta,float cena, string nazwa, string opis): Towar(cena, nazwa, opis)
- {
- this->nazwa_producenta=nazwa_producenta;
- }
- void podsumuj(){
- cout<<nazwa_producenta<<" "<<cena<<" "<<nazwa<<" "<<opis<<"\n";
- }
- };
- class Nosnik :public Towar{
- protected:
- int wielkosc;
- public:
- Nosnik (int wielkosc, float cena, string nazwa, string opis):Towar(cena,nazwa,opis)
- {
- this->wielkosc=wielkosc;
- }
- };
- class Telefon :public Urzadzenie{
- protected:
- string model;
- public:
- Telefon(string model,string nazwa_producenta,float cena, string nazwa, string opis):Urzadzenie(nazwa_producenta,cena,nazwa,opis)
- {
- this->model=model;
- }
- };
- class Smartfon: public Telefon {
- protected:
- bool barometr;
- bool hd;
- bool termometr;
- public:
- Smartfon(bool barometr, bool hd,bool termometr,string model,string nazwa_producenta,float cena, string nazwa, string opis): Telefon(model,nazwa_producenta,cena,nazwa,opis)
- {
- this->barometr=barometr;
- this->hd=hd;
- this->termometr=termometr;
- }
- };
- class Dumbfon: public Telefon {
- protected:
- bool wyswietlacz;
- public:
- Dumbfon(bool wyswietlacz,string model,string nazwa_producenta,float cena, string nazwa, string opis):Telefon(model,nazwa_producenta,cena,nazwa,opis)
- {
- this->wyswietlacz=wyswietlacz;
- }
- };
- class Komputer: public Urzadzenie{
- protected:
- string model;
- public:
- Komputer(string model,string nazwa_producenta,float cena, string nazwa, string opis):Urzadzenie(nazwa_producenta,cena,nazwa,opis)
- {
- this->model=model;
- }
- };
- class Tablet: public Komputer{
- protected:
- int wyswietlacz;
- public:
- Tablet(int wyswietlacz,string model,string nazwa_producenta,float cena, string nazwa, string opis):Komputer(model,nazwa_producenta,cena,nazwa,opis)
- {
- this->wyswietlacz=wyswietlacz;
- }
- };
- class Laptop:public Komputer{
- protected:
- string system;
- public:
- Laptop(string system,string model,string nazwa_producenta,float cena, string nazwa):Komputer(model,nazwa_producenta,cena,nazwa,opis)
- {
- this->system=system;
- }
- };
- class Plyta :public Nosnik{
- protected:
- string rodzaj_danych;
- public:
- Plyta(string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Nosnik(wielkosc,cena,nazwa,opis)
- {
- this->rodzaj_danych=rodzaj_danych;
- }
- };
- class Ksiazka:public Nosnik{
- protected:
- int ilosc_stron;
- public:
- Ksiazka(int ilosc_stron,int wielkosc, float cena, string nazwa, string opis):Nosnik(wielkosc,cena,nazwa,opis)
- {
- this->ilosc_stron=ilosc_stron;
- }
- };
- class CD :public Plyta{
- protected:
- string nazwa1;
- public:
- CD(string nazwa1,string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Plyta(rodzaj_danych,wielkosc,cena,nazwa,opis)
- {
- this->nazwa1=nazwa1;
- }
- };
- class DVD :public Plyta{
- protected:
- string nazwa1;
- public:
- DVD(string nazwa1,string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Plyta(rodzaj_danych,wielkosc,cena,nazwa,opis)
- {
- this->nazwa1=nazwa1;
- }
- };
- class BR :public Plyta{
- protected:
- string nazwa1;
- public:
- BR(string nazwa1,string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Plyta(rodzaj_danych,wielkosc,cena,nazwa,opis)
- {
- this->nazwa1=nazwa1;
- }
- };
- class AD :public Plyta{
- protected:
- string nazwa1;
- public:
- AD(string nazwa1,string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Plyta(rodzaj_danych,wielkosc,cena,nazwa,opis)
- {
- this->nazwa1=nazwa1;
- }
- };
- class Kontener{
- public:
- Towar towarKontenera;
- int iloscKontenera;
- Kontener(){
- }
- };
- class Magazyn:public Towar {
- protected:
- string ilosc;
- string rzecz;
- list < Kontener >::iterator it;
- list < Kontener > lista;
- public:
- void dodajTowar(Towar towar, int ilosc){
- Kontener kontener;
- kontener.towarKontenera = towar;
- kontener.iloscKontenera = ilosc;
- lista.push_back(kontener);
- }
- void listuj(){
- for(it=lista.begin(); it!=lista.end(); it++){
- (*it).towarKontenera;
- }
- }
- };
- int main ()
- {
- Urzadzenie u("nazwa prodcenta", 666, "nazwa", "lala");
- Urzadzenie u2("nazwa prodcenta2", 666, "nazwa2", "lala2");
- Magazyn magazyn;
- magazyn.dodajTowar(u, 5);
- //magazyn.dodajTowar(u2, 8);
- //magazyn.dodajTowar(u, 4);
- //magazyn.dodajTowar(u2, 6);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement