Advertisement
YoFreakinLo

NumericAnswer

Oct 24th, 2020 (edited)
1,803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #ifndef _NUMERIC_ANSWER_H_
  2. #define _NUMERIC_ANSWER_H_
  3.  
  4. #include <answer.h>
  5. #include <duration.h>
  6. #include <price.h>
  7.  
  8. namespace appointy
  9. {
  10.  
  11. template <typename NumericType>
  12. class NumericAnswer : public Answer
  13. {
  14. public:
  15.     NumericAnswer(NumericType min, NumericType max, NumericType default_value, const Duration &duration, const Price &price) :
  16.         Answer("numeric"),
  17.         _min(min),
  18.         _max(max),
  19.         _default(default_value),
  20.         _duration(duration),
  21.         _price(price)
  22.     {
  23.  
  24.     }
  25.  
  26. public:
  27.     auto min() const -> NumericType
  28.     {
  29.         return _min;
  30.     }
  31.  
  32.     auto max() const -> NumericType
  33.     {
  34.         return _max;
  35.     }
  36.  
  37.     auto default_value() const -> NumericType
  38.     {
  39.         return _default;
  40.     }
  41.  
  42.     auto NumericAnswer::duration() const -> const Duration &
  43.     {
  44.         return _duration;
  45.     }
  46.  
  47.     auto NumericAnswer::price() const -> const Price &
  48.     {
  49.         return _price;
  50.     }
  51.  
  52. private:
  53.     NumericType _min;
  54.     NumericType _max;
  55.     NumericType _default;
  56.     Duration _duration;
  57.     Price _price;
  58. };
  59.  
  60. } // namespace appointy
  61.  
  62. #endif // _NUMERIC_ANSWER_H_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement