Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Zhivotno
- {
- protected:
- string ime;
- public:
- Zhivotno(string ime="")
- {
- this->ime=ime;
- }
- };
- class Kopneni:public Zhivotno
- {
- protected:
- bool krzno;
- string hrana;
- public:
- Kopneni(string ime="", bool krzno=false, string hrana=""):Zhivotno(ime)
- {
- this->krzno=krzno;
- this->hrana=hrana;
- }
- };
- class Lav:public Kopneni
- {
- protected:
- bool div;
- public:
- Lav(string ime="", bool krzno=false, string hrana="", bool div=false):Kopneni(ime, krzno, hrana)
- {
- this->div=div;
- }
- void pecati()
- {
- cout<<"Ime: "<<ime<<endl;
- cout<<"Krzno: "<<krzno<<endl;
- cout<<"Tip hrana: "<<hrana<<endl;
- cout<<"Dali e div? "<<div<<endl;
- }
- };
- class Slon:public Kopneni
- {
- protected:
- char *poteklo;
- public:
- Slon(string ime="", bool krzno=false, string hrana="", char *poteklo=""):Kopneni(ime, krzno, hrana)
- {
- strcpy(this->poteklo, poteklo);
- }
- };
- class Vodeni:public Zhivotno
- {
- protected:
- string dishenje;
- public:
- Vodeni(string dishenje="")
- {
- this->dishenje=dishenje;
- }
- };
- class Jagula:public Vodeni
- {
- protected:
- int jachinaElPolnezh;
- public:
- Jagula(string dishenje="", int jachinaElPolnezh=0):Vodeni(dishenje)
- {
- this->jachinaElPolnezh=jachinaElPolnezh;
- }
- };
- class Delfin:public Vodeni
- {
- protected:
- bool cirkus;
- private:
- Delfin(string dishenje="", bool cirkus=false):Vodeni(dishenje)
- {
- this->cirkus=cirkus;
- }
- };
- int main()
- {
- Lav l("Leo", true, "mesojad", false);
- l.pecati();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement