Guest User

Untitled

a guest
May 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. #ifndef ROIVAD_H_INCLUDED
  2. #define ROIVAD_H_INCLUDED
  3. #include <iostream>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. class Tookojad {
  9.   public:
  10.     void valmistaRavhariieteKomplekt();
  11.     //virtual int type()=0;
  12. };
  13.  
  14. class Rahvaroivad {
  15.   public:
  16.     virtual void prindiKirjeldus();
  17. };
  18.  
  19. class Pohjariided : public Rahvaroivad {
  20.   public:
  21.     String seelik = "Foo";
  22.     String myts = "Bar";
  23.  
  24.     void print() {
  25.       cout << "Seelik: " << this.seelik << ", müts: " << this.myts << endl;
  26.     }
  27. };
  28.  
  29. class Pohja : public Tookojad {
  30.   public:
  31.     Rahvaroivad * valmistaRahvariieteKomplekt() {
  32.       return new Pohjariided();
  33.     };
  34. };
  35.  
  36. class Louna : public Tookojad {
  37.   public:
  38.     void valmistaRahvariieteKomplekt();
  39.     //type = 2;
  40. };
  41.  
  42. class Laane : public Tookojad {
  43.   public:
  44.     void valmistaRahvariieteKomplekt();
  45.     //type = 3;
  46. };
  47.  
  48. class Saare : public Tookojad {
  49.   public:
  50.     void valmistaRahvariieteKomplekt();
  51.     //type = 4;
  52. };
  53.  
  54. class Firmad {
  55.   public:
  56.     Tookojad * tookojad[4] = {new Pohja(), new Louna(), new Laane(), new Saare()};
  57.     Rahvaroivad * tellikomplekt(int type) {
  58.       return tookojad[type].valmistaRahvariieteKomplekt();
  59.     }
  60. };
  61.  
  62. #endif // ROIVAD_H_INCLUDED
Add Comment
Please, Sign In to add comment