Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef ROIVAD_H_INCLUDED
- #define ROIVAD_H_INCLUDED
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- class Tookojad {
- public:
- void valmistaRavhariieteKomplekt();
- //virtual int type()=0;
- };
- class Rahvaroivad {
- public:
- virtual void prindiKirjeldus();
- };
- class Pohjariided : public Rahvaroivad {
- public:
- String seelik;
- String myts;
- Pohjariided() {
- this.seelik = "Foo";
- this.myts = "Bar";
- }
- void print() {
- cout << "Seelik: " << this.seelik << ", müts: " << this.myts << endl;
- }
- };
- class Pohja : public Tookojad {
- public:
- Rahvaroivad * valmistaRahvariieteKomplekt() {
- return new Pohjariided();
- };
- };
- class Louna : public Tookojad {
- public:
- void valmistaRahvariieteKomplekt();
- //type = 2;
- };
- class Laane : public Tookojad {
- public:
- void valmistaRahvariieteKomplekt();
- //type = 3;
- };
- class Saare : public Tookojad {
- public:
- void valmistaRahvariieteKomplekt();
- //type = 4;
- };
- class Firmad {
- public:
- Tookojad * tookojad[4] = {new Pohja(), new Louna(), new Laane(), new Saare()};
- Rahvaroivad * tellikomplekt(int type) {
- return tookojad[type].valmistaRahvariieteKomplekt();
- }
- };
- #endif // ROIVAD_H_INCLUDED
Add Comment
Please, Sign In to add comment