worker0.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // worker0.h -- working classes
  2. #ifndef WORKER0_H_
  3. #define WORKER0_H_
  4. #include <string>
  5. class Worker // an abstract base class
  6. {
  7. private:
  8. std::string fullname;
  9. long id;
  10. public:
  11. Worker() : fullname("no one"), id(0L) {}
  12. Worker(const std::string & s, long n)
  13. : fullname(s), id(n) {}
  14. virtual ~Worker() = 0; // pure virtual destructor
  15. virtual void Set();
  16. virtual void Show() const;
  17. };
  18. class Waiter : public Worker
  19. {
  20. private:
  21. int panache;
  22. public:
  23. Waiter() : Worker(), panache(0) {}
  24. Waiter(const std::string & s, long n, int p = 0)
  25. : Worker(s, n), panache(p) {}
  26. Waiter(const Worker & wk, int p = 0)
  27. : Worker(wk), panache(p) {}
  28. void Set();
  29. void Show() const;
  30. };
  31. class Singer : public Worker
  32. {
  33. protected:
  34. enum {other, alto, contralto, soprano,
  35. bass, baritone, tenor};
  36. enum {Vtypes = 7};
  37. private:
  38. static char *pv[Vtypes]; // string equivs of voice types
  39. int voice;
  40. public:
  41. Singer() : Worker(), voice(other) {}
  42. Singer(const std::string & s, long n, int v = other)
  43. : Worker(s, n), voice(v) {}
  44. Singer(const Worker & wk, int v = other)
  45. : Worker(wk), voice(v) {}
  46. void Set();
  47. void Show() const;
  48. };
  49. #endif