Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Zemjeni
- {
- protected:
- int brTrkala;
- public:
- Zemjeni(int brTrkala=0)
- {
- this->brTrkala=brTrkala;
- }
- };
- class Kola:public Zemjeni
- {
- protected:
- string pogon;
- int brSedishta;
- public:
- Kola(int brTrkala=0, string pogon="", int brSedishta=0):Zemjeni(brTrkala)
- {
- this->pogon=pogon;
- this->brSedishta=brSedishta;
- }
- };
- class Voz:public Zemjeni
- {
- protected:
- int vagoni;
- bool parna;
- public:
- Voz(int brTrkala=0,int vagoni=0, bool parna=false):Zemjeni(brTrkala)
- {
- this->vagoni=vagoni;
- this->parna=parna;
- }
- };
- class Vodeni
- {
- protected:
- bool brPerki;
- public:
- Vodeni(bool brPerki=false)
- {
- this->brPerki=brPerki;
- }
- };
- class Brod:public Vodeni
- {
- protected:
- bool sidro;
- string ime;
- public:
- Brod(bool brPerki=false, bool sidro=false, string ime=""):Vodeni(brPerki)
- {
- this->sidro=sidro;
- this->ime=ime;
- }
- };
- class Podmornica:public Vodeni
- {
- protected:
- int dlabochina;
- public:
- Podmornica(bool brPerki=false, int dlabochina=0):Vodeni(brPerki)
- {
- this->dlabochina=dlabochina;
- }
- };
- class Vozdushni
- {
- protected:
- bool brKrila;
- public:
- Vozdushni(bool brKrila=false)
- {
- this->brKrila=brKrila;
- }
- };
- class Avion:public Vozdushni
- {
- protected:
- int rasponKrila;
- public:
- Avion(bool brKrila=false, int rasponKrila=0):Vozdushni(brKrila)
- {
- this->rasponKrila=rasponKrila;
- }
- };
- class Helikopter:public Vozdushni
- {
- protected:
- int dolzhinaPerki;
- bool voen;
- public:
- Helikopter(bool brKrila=false, int dolzhinaPerki=0, bool voen=false):Vozdushni(brKrila)
- {
- this->dolzhinaPerki=dolzhinaPerki;
- this->voen=voen;
- }
- void pecati()
- {
- cout<<"Broj krila: "<<brKrila<<endl;
- cout<<"Dolzhina perki: "<<dolzhinaPerki<<endl;
- cout<<"Voen: "<<voen<<endl;
- }
- };
- int main()
- {
- Helikopter h(true, 20, false);
- h.pecati();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement